andorid之UI

位置分区

控制控件的行为的方式:

1.xml文件

2.使用set方法

ui设计就是在viewgroup中添加。

button和editview继承自textview

textview继承自view

注意根布局的设置

颜色代码表http://blog.csdn.net/u014096171/article/details/52400956

 

附上xml文件:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="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="com.example.administrator.ui1.MainActivity">


<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="#E6E6FA"
tools:layout_editor_absoluteX="8dp"
tools:layout_editor_absoluteY="8dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/more"
android:layout_marginRight="303dp"
android:layout_marginEnd="303dp"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="小米账号登陆"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:textSize="25dp"
android:textColor="#00F"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="注册"
android:layout_alignParentRight="true"
android:background="@null"
/>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="账号"
android:layout_marginLeft="20dp"
android:textSize="20dp"
/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="请输入账号"
android:layout_marginLeft="10dp"
android:layout_marginRight="20dp"
/>
</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="密码"
android:layout_marginLeft="20dp"
android:textSize="20dp"
/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="请输入密码"
android:layout_marginLeft="10dp"
android:layout_marginRight="20dp"
android:inputType="textPassword"
/>

</LinearLayout>

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="登陆"
android:layout_marginLeft="150dp"
android:layout_marginTop="20dp"
android:background="#E6E6FA"
/>
</LinearLayout>

 

 

posted @ 2017-03-12 14:15  爱编程的文科生  阅读(243)  评论(0编辑  收藏  举报