现在的位置: 首页 > 综合 > 正文

QQ登陆界面

2017年12月17日 ⁄ 综合 ⁄ 共 2407字 ⁄ 字号 评论关闭

终于完成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

抱歉!评论已关闭.