您的位置:首页 > 其它

QQ登陆界面

2013-01-15 10:34 148 查看
终于完成QQ登陆界面布局,哎,这是Android 工作的第一个工作任务。虽然做了两三天,但很欣慰,最终能够完成。

下面我把自己感觉最难的布局贴出来,即QQ账号的布局,困扰我好久,因为之前没练过。



QQ账号(即上面其中一个布局)布局代码:

<RelativeLayout

android:layout_width="match_parent"

android:layout_height="match_parent" >

<EditText

android:id="@+id/accout_edit"

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:layout_marginLeft="55dp"

android:layout_marginRight="50dp"

android:background="@drawable/qq_edit_login"

android:hint="请输入账号"

android:numeric="integer"

android:paddingLeft="50dp"

android:paddingTop="10sp"

android:singleLine="true"

android:maxLength="12"

android:textSize="20dp" />

<TextView

android:id="@+id/count_txt"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_marginLeft="60dp"

android:paddingTop="10dp"

android:layout_alignTop="@id/accout_edit"

android:layout_alignBottom="@id/accout_edit"

android:text="账号"

android:textSize="20dp" />

<ImageButton

android:id="@+id/imagebuttom"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_toRightOf="@id/count_txt"

android:layout_alignTop="@id/accout_edit"

android:layout_alignBottom="@id/accout_edit"

android:layout_marginLeft="135dp"

android:background="@drawable/account_button_prsess" />

<!-- 注意定位方式,在ImageButton 中现在对齐方式中在TextView的右边,在能在layout_marginLeft="135dp"体现出,在

距离左边135dp的距离。还有注意方向 -->

</RelativeLayout>

资源文件:



account_button_press.xml:

<?xml version="1.0" encoding="UTF-8"?>

<selector

xmlns:android="http://schemas.android.com/apk/res/android">

<item android:state_pressed="true" android:drawable="@drawable/button2_down" />

<!-- press -->

<item android:state_focused="true" android:state_enabled="true" android:drawable="@drawable/button2_over" />

<!--focused -->

<item android:state_enabled="true" android:drawable="@drawable/button2" />

<!-- defauld -->

</selector>

qq_edit_login.xml:

<?xml version="1.0" encoding="UTF-8"?>

<selector

xmlns:android="http://schemas.android.com/apk/res/android">

<item android:state_enabled="false" android:drawable="@drawable/input" />

<item android:state_pressed="true" android:drawable="@drawable/input" />

<item android:state_focused="true" android:drawable="@drawable/input_over" />

</selector>

图片:



希望大家能够在Android方面相互学习,相互探讨!

日起:2013.115
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: