2016-08-09 54 views

回答

0
<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_margin="10dp" 
    android:layout_height="wrap_content"> 
<EditText 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:background="@drawable/round_corner" 
    android:padding="10dp" 
    android:hint="First Name *" 
    android:textColorHint="#a9a9b3" 
    android:textSize="18dp" 
    /> 
</LinearLayout> 

添加此然後創建圓角背景繪製文件

<?xml version="1.0" encoding="UTF-8"?> 
<shape xmlns:android="http://schemas.android.com/apk/res/android"> 
<solid android:color="#FFFFFF"/> 
<stroke android:width="2dip" android:color="#b0b6bc" /> 
<corners android:radius="3dip"/> 
<padding android:left="0dip" android:top="0dip" android:right="0dip" 
android:bottom="0dip" /> 
</shape> 

output image

1
<EditText 
     android:layout_width="300dp" 
     android:layout_height="40dp" 
     android:hint=" Name*" 
     android:background="@drawable/border" 
     android:layout_centerHorizontal="true" 
     android:layout_centerVertical="true"/> 

創建drawble文件夾中的XML在它

<?xml version="1.0" encoding="utf-8"?> 
<shape xmlns:android="http://schemas.android.com/apk/res/android"> 
    <solid android:color="#ffffff" /> 
    <stroke android:width="1dip" android:color="#363534" /> 
    <corners android:radius="5dp" /> 
</shape>