代码应该没问题,模拟器跑出来也没问题,但是放到手机上跑发现界面布局显示不全
上面那张图是模拟器的,下面是我手机截图,手机型号vivo x50 pro
您的每一个用心回答,都会让这个世界变得更美好一些!
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:orientation="vertical" android:layout_height="match_parent"> <LinearLayout android:layout_width="match_parent" android:layout_height="40dp" android:orientation="horizontal" android:background="@color/purple_700"> <ImageView android:id="@+id/home_scan" android:layout_width="30dp" android:layout_height="30dp" android:layout_centerVertical="true" android:layout_marginStart="16dp" android:src="@mipmap/scan" /> <EditText android:id="@+id/home_search_edit" android:layout_width="0dp" android:layout_height="30dp" android:layout_weight="1" android:layout_centerVertical="true" android:layout_marginStart="16dp" android:layout_toEndOf="@id/home_scan" android:background="@drawable/shape_home_edt_text" android:hint="@string/Search_home_edit_text" android:paddingStart="10dp" android:textSize="18sp" tools:ignore="RtlSymmetry" /> <ImageView android:layout_width="30dp" android:layout_height="30dp" android:layout_centerVertical="true" android:layout_marginStart="16dp" android:layout_toEndOf="@id/home_search_edit" android:src="@mipmap/search" /> </LinearLayout> <FrameLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/base_container"/> </LinearLayout>
因为没做适配啊
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:orientation="vertical" android:layout_height="match_parent"> <RelativeLayout android:layout_width="match_parent" android:layout_height="40dp" android:background="@color/purple_700"> <ImageView android:id="@+id/home_scan" android:layout_width="30dp" android:layout_height="30dp" android:layout_centerVertical="true" android:layout_marginStart="16dp" android:src="@mipmap/scan" /> <EditText android:id="@+id/home_search_edit" android:layout_width="280dp" android:layout_height="30dp" android:layout_centerVertical="true" android:layout_marginStart="16dp" android:layout_toEndOf="@id/home_scan" android:background="@drawable/shape_home_edt_text" android:hint="@string/Search_home_edit_text" android:paddingStart="10dp" android:textSize="18sp" tools:ignore="RtlSymmetry" /> <ImageView android:layout_width="30dp" android:layout_height="30dp" android:layout_centerVertical="true" android:layout_marginStart="16dp" android:layout_toEndOf="@id/home_search_edit" android:src="@mipmap/search" /> </RelativeLayout> <FrameLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/base_container"/> </LinearLayout>
那么,你的代码是怎么写的呢?不给代码,我们也不能猜出来呀
因为没做适配啊
那么,你的代码是怎么写的呢?不给代码,我们也不能猜出来呀