LinearLayout(线性布局):
:layout/activity_main.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="用户名:"/>
<EditText android:layout_width="0dp"
android:layout_height="wrap_content"
android:hint="请输入1-10个字符"
android:layout_weight="1"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="密 码:"/>
<EditText android:layout_width="0dp"
android:layout_height="wrap_content"
android:hint="请输入1-10个字符"
android:layout_weight="1"
android:password="true"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="20dp">
<View android:layout_width="0dp"
android:layout_height="30dp"
android:layout_weight="1"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="30dp"
android:background="@drawable/btn_bg"
android:drawableLeft="@drawable/login32x32"
android:text="登陆" />
<View android:layout_width="0dp"
android:layout_height="30dp"
android:layout_weight="1"
/>
<Button android:text="退出"
android:drawableLeft="@drawable/exit32x32"
android:background="@drawable/btn_bg"
android:layout_width="wrap_content"
android:layout_height="30dp"/>
<View android:layout_width="0dp"
android:layout_height="30dp"
android:layout_weight="1"
/>
</LinearLayout>
</LinearLayout>
效果:
相关推荐
Android移动应用开发线性布局LinearLayout的weight属性简介.pdf 学习资料 复习资料 教学资源
Android开发学习23】界面布局之线性布局LinearLayout代码
Android移动应用开发线性布局LinearLayout的常用属性.pdf 学习资料 复习资料 教学资源
但是从面向对象的观点来看,ViewGroup 继承自 View,所以 ViewGroup组件布局——线性布局LinearLayout 是线性布局控件,它包含的子
主要介绍了Android编程之线性布局LinearLayout用法,结合实例形式简单分析了Android线性布局的使用技巧,需要的朋友可以参考下
智能家居系统 线性布局LinearLayout.doc 学习资料 复习资料 教学资源
Android中线性布局LinearLayout的特点.pdf 学习资料 复习资料 教学资源
android 线性布局LinearLayout实例代码,需要的朋友可以参考一下
Android常见的布局类型是线性布局(LinearLayout),包含布局方向设置、基本使用、常用使用案例以及实现均分案例(垂直均分、水平均分)、以及线性布局嵌套,实现垂直且水平居中,整体按照“理论+案例”,分析清晰,...
关于linearlayout布局案例
摘要:Java源码,Android源码,线性布局 一个基础级的Android线性布局实例——LinearLayout源码下载,帮助Android初学者了解线性布局的思路和实现方法,这里暂时没有安卓运行环境,所以没有抓到运行效果,还望理解,...
主要为大家详细介绍了AndroidUI组件LinearLayout线性布局,具有一定的实用性,感兴趣的小伙伴们可以参考一下
用Android Studio 2.3.3做的线性布局例子,主要用到的标签有:<LinearLayout></LinearLayout>;主要用到的设置有:android:orientation="horizontal"、android:layout_weight="1"。
很多时候,线性布局需要嵌套其他布局,比如线性布局,相对布局等
android demo,自定义LinearLayout的实现。
线性布局(LinearLayout)是 Android 中最基本的布局之一,用于在界面上按照水平或垂直方向依次排列子视图。它是一种简单而灵活的布局方式,适用于许多应用场景,如列表项、工具栏、表单等等。 在 Android 开发中,...
移动互联网应用
AndroidStdio LinearLayout 线性布局写一个登录界面_顾缘君兮的博客-CSDN博客.html
智能家居系统应用