如何在 Android 中实现此 UI [英] How can I implement this UI in Android

查看:17
本文介绍了如何在 Android 中实现此 UI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个如图所示的 UI,虽然不完全是这样,但类似.我该如何实施?

I want to create an UI as shown in the figure, not exactly, though, but similar. How can I implement this?

推荐答案

为此,您需要制作一个 xml 文件并将其放入 drawable 文件夹中.

For that you need to make one xml file and put it into drawable folder .

<?xml version="1.0" encoding="UTF-8"?> 
<shape xmlns:android="http://schemas.android.com/apk/res/android"> 
    <solid android:color="#ffffffff"/>    

    <stroke android:width="1dp"
            android:color="#ababab"
            />

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

    <corners android:bottomRightRadius="7dp" android:bottomLeftRadius="7dp" 
     android:topLeftRadius="7dp" android:topRightRadius="7dp"/> 
</shape>

现在制作另一个 xml 文件,其中设置 textview 和 edittext .

Now make another xml file in which set textview and edittext .

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

<LinearLayout 
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:background="@drawable/rounded_background"
            android:layout_marginRight="10dp"
            android:layout_marginBottom="10dp" 
            android:layout_marginTop="20dp">

    <LinearLayout android:layout_width="fill_parent"
        android:layout_height="wrap_content" android:orientation="horizontal"
        android:paddingLeft="10dp">

<TextView android:text="Initial"  android:textColor="#686868"
        android:id="@+id/lable" android:textSize="10sp" android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        ></TextView>

        <EditText android:id="@+id/r_email" android:layout_width="fill_parent"
            android:layout_height="35dp" android:singleLine="true"
            android:inputType="textEmailAddress" android:textSize="15sp"
            android:background="@android:color/transparent" android:hint="Initial" />
    </LinearLayout>

    <View android:layout_width="fill_parent" android:layout_height="1dip"
        android:background="#ababab" />

    <LinearLayout android:layout_width="fill_parent"
        android:layout_height="wrap_content" android:orientation="horizontal"
        android:paddingLeft="10dp">

<TextView android:text="Initial"  android:textColor="#686868"
        android:id="@+id/lable" android:textSize="10sp" android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        ></TextView>

        <EditText android:id="@+id/r_email" android:layout_width="fill_parent"
            android:layout_height="35dp" android:singleLine="true"
            android:inputType="textEmailAddress" android:textSize="15sp"
            android:background="@android:color/transparent" android:hint="Initial" />
    </LinearLayout>
</LinearLayout>
</LinearLayout>

这篇关于如何在 Android 中实现此 UI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆