主层代码:activity_main
<span style="font-family:KaiTi_GB2312;font-size:24px;"><RelativeLayout 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:background="@drawable/main_content_bg"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<include
android:id="@+id/include1"
layout="@layout/login_top"/>
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/monkey"
android:layout_alignParentBottom="true"
android:layout_alignRight="@+id/include1"
android:layout_marginBottom="20dp"
>
</ImageView>
<TextView
android:id="@+id/tvForgetPass"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="@+id/include1"
android:layout_below="@+id/include1"
android:layout_marginTop="24dp"
android:text="@string/tvForgetPass"
android:textAppearance="?android:attr/textAppearanceMedium"
/> </RelativeLayout></span>
<span style="font-family: SimSun;">嵌套的登录代码:login</span>
<pre name="code" class="html"><span style="font-family:KaiTi_GB2312;font-size:24px;"><?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/logintopbg"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
>
<EditText
android:id="@+id/etName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:background="@android:drawable/edit_text"
android:drawableLeft="@drawable/icons_user_img"
android:ems="10"
android:hint="@string/etname" >
<requestFocus />
</EditText>
<EditText
android:id="@+id/etPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/etName"
android:layout_below="@+id/etName"
android:layout_marginTop="20dp"
android:background="@android:drawable/edit_text"
android:drawableLeft="@drawable/icons_password_img"
android:drawablePadding="10dp"
android:ems="10"
android:hint="@string/etPassword"
android:inputType="textPassword" />
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/etPassword"
android:layout_below="@+id/etPassword"
android:layout_marginTop="10dp" >
<Button
android:id="@+id/btnLogin"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/btn_select"
android:text="@string/btnLogin" />
<Button
android:id="@+id/btnRegiste"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginLeft="5dp"
android:background="@drawable/btn_select"
android:text="@string/btnRegiste" />
</LinearLayout>
</RelativeLayout></span>
主要的Button和设置:
1.btn_select
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<!--
按钮点击和不点击的效果
属性:
android:state_pressed:
false:未按下
true:按下
-->
<item android:drawable="@drawable/btn_shape" android:state_pressed="false"></item>
<item android:drawable="@drawable/btn_shape_after" android:state_pressed="true"></item>
</selector>
2.btn_shape
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<solid android:color="#FF72CAE1"/>
<corners android:radius="10dp"/>
</shape>
3.btn_shape_after
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<!-- solid:填充色 corners:边角的弧度 -->
<solid android:color="#87cefa"/>
<corners android:radius="10dp"/>
</shape>
4.login
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<solid android:color="#55FFFFFF"/>
<corners android:radius="10dp"/>
</shape>
5.logintopbg
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<solid android:color="#55ffffff"/>
<corners android:radius="10dp"/>
</shape>
表现形式:
待续……