2015-02-11 64 views
0

我想有這樣的EditText上:的Andorid,如何使EditText上這樣

enter image description here

這是我到目前爲止有:

enter image description here

這是我的可繪製代碼:

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

<item> 
    <shape> 
     <solid android:color="#EFEFEF" /> 
    </shape> 
</item> 

<solid android:color="#EFEFEF" /> 
<!-- main color --> 
<item 
    android:bottom="1.5dp" 
    android:left="1.5dp" 
    android:right="1.5dp"> 
    <shape> 
     <solid android:color="#FFFFFF" /> 
    </shape> 
</item> 

<!-- draw another block to cut-off the left and right bars --> 
<item android:bottom="5.0dp"> 
    <shape> 
     <solid android:color="#FFFFFF" /> 
    </shape> 
</item> 

你能幫我做這樣的EditText上?

+0

適用的backgroundColor你的EditText和檢查 – Harish 2015-02-11 07:37:43

回答

0

res/drawable/edit_text_bg.xml

<?xml version="1.0" encoding="utf-8"?> 
<shape xmlns:android="http://schemas.android.com/apk/res/android" > 

    <solid android:color="#EFEFEF" /> 
</shape> 

這是足以讓一個EDITTEXT看起來像你曾經參與過的圖像

0

試試這個backgroundDrawable:

<?xml version="1.0" encoding="utf-8"?> 
<shape xmlns:android="http://schemas.android.com/apk/res/android" 
      android:shape="rectangle"> 

<solid android:color="#EFEFEF" /> 
<stroke android:width="1dp" android:color="@color/black"/> 

</shape> 
0

創建custom_edt.xml,並把它在可繪製文件夾並給背景EDITTEXT

<?xml version="1.0" encoding="utf-8"?> 
<shape xmlns:android="http://schemas.android.com/apk/res/android" > 

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

    <stroke 
     android:width="2dp" 
     android:color="#33b5e5" /> 

    <solid android:color="#FFF" /> 

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

    <shape xmlns:android="http://schemas.android.com/apk/res/android" 
      android:thickness="0.5dp" 
      android:shape="rectangle"> 
     <stroke android:width="2dp" 
      android:color="#D9D9D9"/> 
     <corners android:radius="5dp" /> 
     <gradient 
     android:startColor="#C8C8C8" 
     android:endColor="#EFEFEF" 
     android:type="linear" 
     android:angle="270"/> 
    </shape> 



<EditText 
      android:id="@+id/inputSearchEditText" 
      android:layout_margin="15dp" 
      android:layout_centerVertical="true" 
      android:layout_width="match_parent" 
      android:layout_height="100dp" 
      android:ellipsize="start" 
      android:gravity="center" 
      android:hint="Search text" 
      android:inputType="text" 
      android:background="@drawable/shape"/>