我尝试过这个:
rounded_textfield.xml:
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" android:padding="10dp">
<solid android:color="#EEEEEE"/>
<corners
android:bottomRightRadius="8dp"
android:bottomLeftRadius="8dp"
android:topLeftRadius="8dp"
android:topRightRadius="8dp"/>
</shape>
activity.xml:
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/searchField" android:layout_row="0" android:layout_column="0"
android:drawableLeft="@drawable/search"
android:background="@drawable/rounded_edittext" android:minHeight="50dp"/>
在编辑器中它是灰色的,但在手机上它是白色的。
#FF0000
,看看是否有效吗?你的形状看起来还不错,但是#EEE
很接近白色,很难确保它是否有效。 - Paulo Avelar#EEEEEE
。然后您就可以检查是否有任何差异了。 - activesince93