android注册/登录圆角界面设计

来源:互联网 发布:我知女人心 迅雷 编辑:程序博客网 时间:2024/05/20 17:10

摘要:对android注册/登录界面的设计,背景为白色,带黑色圆形边框。其中边框的实现可以是使用背景图片,即

android:background="@drawable/CornerPicture";另外一种方法就新建edit_bg.xml再重写shape中的corners

android:radius="10dp" />,说明圆角半径为10dp,然后在layout中使用android:background="@drawable/edit_bg"即可;同时本文

提供了android开发图标下载网址,仅供参考。

1.注册/登录界面整体代码如下:

<LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="184dp"
            android:layout_marginLeft="20dp"
            android:layout_marginRight="20dp"
            android:layout_marginTop="30dp"
            android:background="@drawable/edit_bg"
            android:orientation="vertical" >

            <LinearLayout
                android:layout_width="fill_parent"
                android:layout_height="40dp"
                android:layout_marginLeft="5dp"
                android:layout_marginTop="10dp"
                android:orientation="horizontal" >

                <ImageView
                    android:layout_width="40dp"
                    android:layout_height="40dp"
                    android:layout_marginLeft="5dp"
                    android:background="@drawable/ic_menu_contact" />

                <EditText
                    android:id="@+id/NameEdit"
                    android:layout_width="match_parent"
                    android:layout_height="40dp"
                    android:layout_marginLeft="10dp"
                    android:background="@null"
                    android:hint="@string/NameStr"
                    android:inputType="textPersonName"
                    android:textColor="@color/black"
                    android:textSize="20sp" />
            </LinearLayout>

            <TextView
                android:layout_width="fill_parent"
                android:layout_height="2dp"
                android:layout_marginTop="10dp"
                android:background="@color/gray" />

            <LinearLayout
                android:layout_width="fill_parent"
                android:layout_height="40dp"
                android:layout_marginLeft="5dp"
                android:layout_marginTop="10dp"
                android:orientation="horizontal" >

                <ImageView
                    android:layout_width="40dp"
                    android:layout_height="40dp"
                    android:layout_marginLeft="5dp"
                    android:background="@drawable/ic_menu_login" />

                <EditText
                    android:id="@+id/CodeEdit"
                    android:layout_width="match_parent"
                    android:layout_height="40dp"
                    android:layout_marginLeft="10dp"
                    android:background="@null"
                    android:hint="@string/CodeStr"
                    android:inputType="textPassword"
                    android:textColor="@color/black"
                    android:textSize="20sp" />
            </LinearLayout>

            <TextView
                android:layout_width="fill_parent"
                android:layout_height="2dp"
                android:layout_marginTop="10dp"
                android:background="@color/gray" />

            <LinearLayout
                android:layout_width="fill_parent"
                android:layout_height="40dp"
                android:layout_marginLeft="5dp"
                android:layout_marginTop="10dp"
                android:orientation="horizontal" >

                <ImageView
                    android:layout_width="40dp"
                    android:layout_height="40dp"
                    android:layout_marginLeft="5dp"
                    android:background="@drawable/ic_menu_account_list" />

                <EditText
                    android:id="@+id/ReCodeEdit"
                    android:layout_width="match_parent"
                    android:layout_height="40dp"
                    android:layout_marginLeft="10dp"
                    android:background="@null"
                    android:hint="@string/SureCodeStr"
                    android:inputType="textPassword"
                    android:textColor="@color/black"
                    android:textSize="20sp" />
            </LinearLayout>
        </LinearLayout>

2.edit_bg.xml中的代码如下:
solid功能是填充整个框的背景颜色;stroke是边框颜色及宽度;corners是边框角弧度大小。
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >

    <solid android:color="@color/white" />

    <stroke
        android:width="1dp"
        android:color="@color/gray" />

    <corners android:radius="10dp" />

    <padding
        android:bottom="0dp"
        android:left="0dp"
        android:right="0dp"
        android:top="0dp" />

</shape>

3.String中的文字如下:

  <string name="NameStr">请输入用户名</string>
    <string name="CodeStr">请输入密码</string>
    <string name="SureCodeStr">请确认密码</string>

4.ico图标下载地址如下:

非常好的一个android开发图标下载网址:http://sudasuta.com/android-icons.html


 

0 0