我想要一個四捨五入的EditText。EditText不會變圓
我在佈局的EditText就像
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp" >
<EditText
android:id="@+id/EditTextSearch"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/edit_round"
android:padding="5dip"
android:singleLine="true" >
<requestFocus />
</EditText>
<ImageView
android:id="@+id/searchBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:src="@android:drawable/ic_menu_search" />
</FrameLayout>
,我使用的的EditText背景的繪製就像
<?xml version="1.0" encoding="utf-8"?>
<!-- res/drawable/rounded_edittext.xml -->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:padding="10dp"
android:shape="rectangle" >
<solid android:color="#FFFFFF" />
<corners
android:bottomLeftRadius="12dp"
android:bottomRightRadius="12dp"
android:topLeftRadius="12dp"
android:topRightRadius="12dp" />
</shape>
在我的XML圖形佈局,我的EditText外觀精緻而圓潤,但在模擬器,並在設備中看起來不是這樣嗎?
有沒有人有任何想法,爲什麼會這樣?
感謝
爲什麼在''標籤中有'android:padding =「10dp」'屬性? http://developer.android.com/guide/topics/resources/drawable-resource.html#Shape –
刪除了「android:padding」標記,仍然沒有任何改進。所以放置google鏈接也沒有幫助。正如我在xml的圖形設計部分所說的那樣,edittext看起來很好,並且在設備或模擬器中測試過了,因此您可以對其進行舍入處理: – kaplanfat