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>

效果:


本文出自 “追随心的彼岸” 博客,谢绝转载!

更多相关文章

  1. Android: R cannot be resolved to a variable
  2. android 用代码编写linearlayout布局
  3. LinearLayout(线性布局)
  4. 【Android】android 输入框EditText禁止输入Emoji表情符
  5. android中限制EditText最大输入字节数
  6. android 用代码编写linearlayout布局
  7. Android(安卓)TextUtils类介绍
  8. android 大文件分割上传(分块上传)
  9. 【转】Android中对json的解析和处理

随机推荐

  1. Go微服务入门到容器化实践,落地可观测的微
  2. K8S pod创建、标签、资源限制、调度
  3. 2021-2-16:请问你知道分布式设计模式中的Q
  4. 自学第八十天
  5. 新RabbitMQ精讲,项目驱动落地,分布式事务拔
  6. Spark3大数据实时处理-Streaming+Structu
  7. 如何零基础学习编程
  8. pinpoint通过api批量设置告警
  9. 协程原理从入门到精通 每个后端开发都需
  10. Clickhouse集群性能测试(全网独家精华版)