android 现在越来越火,之前大量的桌面软件,现在都开发出android版了。最近也在学习android,顺便做了几个demo.不说废话了,上图。
接下来是布局:
<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/bg" > <ImageView android:id="@+id/myImage" android:layout_width="70dip" android:layout_height="70dip" android:layout_marginTop="65dip" android:layout_centerHorizontal="true" android:src="@drawable/login_default_avatar" android:background="@drawable/fillet_shape"/> <LinearLayout android:id="@+id/input" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@id/myImage" android:layout_marginLeft="28.0dip" android:layout_marginRight="28.0dip" android:background="@drawable/login_input" android:orientation="vertical" > <LinearLayout android:layout_width="fill_parent" android:layout_height="30dip" android:background="@drawable/login_input" android:gravity="center_vertical" android:orientation="horizontal" > <EditText android:id="@+id/searchEditText" android:layout_width="0dp" android:layout_height="30dp" android:layout_weight="1" android:background="@null" android:ems="10" android:imeOptions="actionDone" android:singleLine="true" android:textSize="16sp" > <requestFocus /> </EditText> <Button android:id="@+id/button_clear" android:layout_width="10dip" android:layout_height="10dip" android:layout_marginRight="8dip" android:background="@drawable/login_input_arrow" android:visibility="visible" /> </LinearLayout> <View android:layout_width="fill_parent" android:layout_height="1.0px" android:layout_marginLeft="1.0px" android:layout_marginRight="1.0px" android:background="#ffc0c3c4" /> <EditText android:id="@+id/password" android:layout_width="fill_parent" android:layout_height="30.0dip" android:background="#00ffffff" android:gravity="center_vertical" android:inputType="textPassword" android:maxLength="16" android:maxLines="1" android:textColor="#ff1d1d1d" android:textColorHint="#ff666666" android:textSize="16.0sp" /> </LinearLayout> <Button android:id="@+id/buton1" android:layout_width="270dp" android:background="@drawable/chat_send_button_bg" android:paddingTop="5.0dip" android:layout_height="50dp" android:layout_marginLeft="28.0dip" android:layout_marginRight="28.0dip" android:layout_marginTop="12.0dip" android:layout_below="@+id/input" android:gravity="center" android:textSize="20dp" android:text="登录" /> <RelativeLayout android:id="@+id/relative" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignLeft="@+id/input" android:layout_alignRight="@+id/input" android:layout_below="@id/buton1" > <CheckBox android:id="@+id/auto_save_password" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:background="@null" android:button="@null" android:checked="true" android:drawableLeft="@drawable/checkbox_bg1" android:drawablePadding="4.0dip" android:text="记住密码" android:textColor="#ffffffff" android:textSize="12.0sp" /> </RelativeLayout> </RelativeLayout> 下面是几个样式: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" > <solid android:color="#ffffff"/> <corners android:radius="10px"/> <padding android:left="3dip" android:top="3dip" android:right="3dip" android:bottom="3dip"/> </shape><?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_enabled="true" android:state_checked="false" android:state_pressed="false" android:drawable="@drawable/checkbox_unselect" /> <item android:state_enabled="true" android:state_checked="false" android:state_pressed="true" android:drawable="@drawable/checkbox_unselect_press" /> <item android:state_enabled="true" android:state_checked="true" android:state_pressed="false" android:drawable="@drawable/checkbox_selected" /> <item android:state_enabled="true" android:state_checked="true" android:state_pressed="true" android:drawable="@drawable/checkbox_selected_press" /> <item android:drawable="@drawable/checkbox_unselect" /> </selector> 代码下载;http://download.csdn.net/detail/qq83667664/9602812