eidtText appears white border bar on Xiaomi mobile phone, but it doesn't appear on Huawei Samsung and other mobile phones. It specially records the problem of adaptation
The white border appears directly in the search section to view the code
<RelativeLayout
android:id="@+id/et_search_root"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="25dp"
android:layout_weight="1"
android:background="@drawable/shape_search_head_bg"
android:orientation="horizontal">
<EditText
android:id="@+id/et_search"
android:layout_toLeftOf="@+id/iv_search_delete"
android:layout_width="match_parent"
android:layout_height="35dp"
android:gravity="center_vertical"
android:background="@color/transparent"
android:drawableLeft="@drawable/search_white"
android:drawablePadding="7dp"
android:textColorHint="@color/skin_search_font_color"
android:imeOptions="actionSearch"
android:paddingLeft="10dp"
android:maxLines="1"
android:singleLine="true"
android:maxLength="15"
android:ellipsize="end"
android:textSize="15dp"
tools:text=""
android:textColor="@color/skin_common_title"/>
<LinearLayout
android:id="@+id/iv_search_delete"
android:layout_alignParentRight="true"
android:layout_width="35dp"
android:layout_height="35dp"
android:orientation="vertical"
android:gravity="center"
android:visibility="gone"
tools:visibility="visible">
<ImageView
android:layout_width="19.2dp"
android:layout_height="19.2dp"
android:background="@drawable/search_delete"/>
</LinearLayout>
</RelativeLayout>
The problem is as follows: the shape search head BG drawable is loaded in the root layout of RelativeLayout
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/account_line_color" />
<corners
android:radius="4dp"/>
</shape>
Check a very normal drawable, filled in and rounded. There is no problem in Samsung Huawei and other mobile phones, but the above picture will appear in Hongmi and some Xiaomi mobile phones, which is very helpless.
Reference adaptation: EditText background is shown in black on some mobile phones
Found that transparent properties need to be set on Xiaomi mobile phone
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke android:width="1dp" android:color="@color/transparent" />
<solid android:color="@color/account_line_color" />
<corners
android:radius="4dp"/>
</shape>
Added a property: stroke android:width = "1dp" android:color = "@ color/transparent"
It's better to find out, why!!!!!
The final solution is:
In some mobile phones, there are inexplicably white borders or black background colors, which need to be displayed in different attributes such as
It's good that the direct colors such as stroke and solid become transparent. Specific reasons need to be studied!