一、使用TextView ImageView Button EditView做出登录页面

<?xml version="1.0" encoding="utf-8"?>
<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"
tools:context="com.ouc.wkp.ui1.MainActivity"> <RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="#00f"> <ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="15dp"
android:src="@drawable/more_arrow"/> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="小米账号登录"
android:textColor="#ffffff" /> <Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="注册"
android:textColor="#fff" />
</RelativeLayout> <LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="100dp"
android:orientation="vertical"> <LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="账号" /> <EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="请输入邮箱/手机号码/小米账号" /> </LinearLayout> <LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="密码" /> <EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="请输入密码"
android:inputType="textPassword" /> </LinearLayout>
</LinearLayout> <Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="70dp"
android:text="登录" />
</LinearLayout>

activity_main.xml

二、使用ImageView CheckBox RadioButton

注意ImageView的scaleType属性,截图是麦子学院老师的课件

使用RadioButton注意要在外层包裹一个RadioGroup,每个RadioButton需要指定id

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="16dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="16dp"> <!-- scaleType默认情况下是fitCenter -->
<ImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:background="#f00"
android:scaleType="centerCrop"
android:src="@drawable/abc" /> <LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="我喜欢的颜色" /> <CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:text="红色" /> <CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="蓝色" /> <CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="黑色" /> <CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="白色" /> <CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="紫色" />
</LinearLayout> <LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"> <RadioGroup
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"> <RadioButton
android:id="@+id/boy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:text="男" /> <RadioButton
android:id="@+id/girl"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="女" /> </RadioGroup>
</LinearLayout>
</LinearLayout>

imageview_index.xml

android入门——UI(1)的更多相关文章

  1. Android入门——UI(8)——Fragment(2)

    先演示一下如何在一个activity中放置两个Fragment,先定义两个Fragment <?xml version="1.0" encoding="utf-8& ...

  2. Android入门——UI(9)

    SwipRefreshLayout下拉刷新控件 <?xml version="1.0" encoding="utf-8"?> <android ...

  3. Android入门——UI(7)——Fragment

    先上fragment静态加载的代码 <?xml version="1.0" encoding="utf-8"?> <LinearLayout ...

  4. android入门——UI(6)——ViewPager+Menu+PopupWindow

    一.使用ViewPager开发新特性引导界面 <?xml version="1.0" encoding="utf-8"?> <Relative ...

  5. android入门——UI(5)

    最近时间实在匆忙,博客的代码基本没有解释. 介绍ExpandableListView <?xml version="1.0" encoding="utf-8&quo ...

  6. android入门——UI(4)

    GridView控件实现菜单 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xml ...

  7. android入门——UI(3)

    Spinner控件   ListView控件 一.Spinner控件 点击Spinner会弹出一个包含所有可选值的dropdown菜单,从该菜单中可以为Spinner选择一个新值. 有两种指定数据源的 ...

  8. Android入门——UI(2)

    介绍SeekBar拖动条控件.ProgressBar进度条控件.DatePicker日历控件.TimePicker时间控件 <?xml version="1.0" encod ...

  9. 【详细】Android入门到放弃篇-YES OR NO-》各种UI组件,布局管理器,单元Activity

    问:达叔,你放弃了吗? 答:不,放弃是不可能的,丢了Android,你会心疼吗?如果别人把你丢掉,你是痛苦呢?还是痛苦呢?~ 引导语 有人说,爱上一个人是痛苦的,有人说,喜欢一个人是幸福的. 人与人之 ...

随机推荐

  1. 探究adroid活动

    Intent用处 隐式使用intent,在被启动的activity的manifest文件配置该活动 在出发活动建立intent时就写好和 网页浏览器用new intent 时用Intent.ACTIO ...

  2. wchar_t 、UTF-8、UTF-16的转换方法 - luketty的专栏 - 博客频道 - CSDN.NET

    wchar_t .UTF-8.UTF-16的转换方法 - luketty的专栏 - 博客频道 - CSDN.NET wchar_t .UTF-8.UTF-16的转换方法

  3. 匹配html标签的正则式

    $reg = "/<" + element + "[^<>]*?\s+" + attr + "=['\"]?(.*?)[' ...

  4. java——推断日期是否在今天之前

    这里说的日期是指字符串的日期格式,如"2014-10-15",我们要推断这个日期是否在今天之前,网上看到好多推断的方法,都是拿这个日期转换成Date对象 然后与new Date() ...

  5. [ACM] hdu 1003 Max Sum(最大子段和模型)

    Max Sum Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Su ...

  6. C#格式化成小数

    datagridview某列格式化成两位小数 ............................................................................. ...

  7. “entities.LastOrDefault()”引发了类型“System.NotSupportedException”的异常

    问题: var entities = new ShipuPlanBLO().UserList(userId, beginDate, endDate); DateTime maxDate = entit ...

  8. Tomcat启动失败的解决方法

    在使用Tomcat的时候,经常会遇到启动失败的问题:解决方法:1.检查环境变量的配置,jdk的配置2.检查端口是否被占用. 关于环境变量的配置很容易搜到,如果按照网上的教程配置好了,但是还是启动失败的 ...

  9. 持续集成 之 apache-continuum

    作者:许振坪,http://blog.csdn.net/benkaoya 1.前言 最近在研究持续集成,摸索了很多持续集成的工具,Apache Continuum也包括其中.既然飞过,那就留下点什么吧 ...

  10. 关于 MyBatis MyBatis-Spring Jdbc 批量插入的各种比较分析

    因为目前SME项目中编写了一套蜘蛛爬虫程序,所以导致插入数据库的数据量剧增.就项目中使用到的3种DB插入方式进行了一个Demo分析: 具体代码如下: 1: MyBatis 开启Batch方式,最普通的 ...