场景

Android布局管理器-从实例入手学习相对布局管理器的使用:

https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/103838924

线性布局LinearLayout,分为水平和垂直线性布局。

实现效果如下

 

 

注:

博客:
https://blog.csdn.net/badao_liumang_qizhi
关注公众号
霸道的程序猿
获取编程相关电子书、教程推送与免费下载。

实现

将activity修改为LinearLayout布局

 

 

并且通过   

android:orientation="vertical"

设置其为竖直线型布局。

然后添加两个输入框分别为用户名和密码

通过

android:hint="请输入账户"

设置输入框提示文本

通过

android:drawableLeft="@drawable/account"

设置输入框左边的图片

这里的图片是放在res下的drawable目录下

 

 

然后添加一个按钮,设置其颜色。

完整示例代码

<?xml version="1.0" encoding="utf-8"?>"http://schemas.android.com/apk/res/android"    xmlns:app="http://schemas.android.com/apk/res-auto"    xmlns:tools="http://schemas.android.com/tools"    android:layout_width="match_parent"    android:layout_height="match_parent"    android:orientation="vertical"    tools:context=".LinearLayoutActivity">    <EditText        android:layout_width="match_parent"        android:layout_height="wrap_content"        android:paddingBottom="20dp"        android:hint="请输入账户"        android:drawableLeft="@drawable/account"        />    <EditText        android:layout_width="match_parent"        android:layout_height="wrap_content"        android:paddingBottom="20dp"        android:hint="请输入密码"        android:drawableLeft="@drawable/pass"        />    <Button        android:layout_width="match_parent"        android:layout_height="wrap_content"        android:text="登录"        android:textColor="#FFFFFF"        android:background="#FF009688"        />

更多相关文章

  1. Android(安卓)RecyclerView设置多选
  2. Android(安卓)设置EditText的DrawableRight和DrawableLeft 的通
  3. Android添加权限AndroidManifes.xml
  4. android webview 显示不出来
  5. android webview的 一些设置(js java交互)
  6. Android新控件MotionLayout介绍(一)
  7. Android动画Animator开发问题
  8. MPAndroidChart常见设置属性(一)——应用层
  9. Android(安卓)notification的使用实例

随机推荐

  1. 【Android多媒体】多媒体架构-Android官
  2. Airbnb Android
  3. android studio 插件 - .ignore
  4. android命令总结
  5. android 按钮背景色的渐变效果实现
  6. ubuntu16.04 compile android L error
  7. Android 内置图片
  8. android双服务,消息通知(manifest)
  9. android手势:GestureDetector
  10. 【转】 Array ,Simple ,SimpleCursor Ada