我需要在项目中使用带网格线的3列网格视图。所以,我有一个结果;如何设置响应式XML的3列网格线
这是注3的结果(5.7" 和版本 “4.4.2”); http://i.imgur.com/fkkKOWE.jpg
这是注5的结果(5.7" 和版本 “机器人M”); http://i.imgur.com/6JFlSdf.jpg
这里我的代码; fragment_homepage.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#fff">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<GridView
android:id="@+id/GVHomepage"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:numColumns="3"
android:verticalSpacing="1dp"
android:horizontalSpacing="1dp"
android:background="#edf2f8" />
<ProgressBar
android:id="@+id/PBLoading"
style="?android:attr/progressBarStyleInverse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true" />
</RelativeLayout>
</LinearLayout>
categories_row.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center">
<RelativeLayout
android:layout_width="120dp"
android:layout_height="120dp"
android:background="#fff">
<TextView
android:id="@+id/TVCategoryName"
android:layout_marginTop="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Yiyecek"
android:textSize="16sp"
android:textStyle="bold"
android:textColor="#745f87"
android:layout_centerHorizontal="true"
android:textAppearance="?android:attr/textAppearanceSmall" />
<ImageView
android:id="@+id/IVCategoryPhoto"
android:layout_width="70dp"
android:layout_height="70dp"
android:scaleType="fitCenter"
android:layout_marginTop="10dp"
android:layout_centerHorizontal="true"
android:layout_below="@+id/TVCategoryName"
android:src="@mipmap/ic_launcher"/>
</RelativeLayout>
</LinearLayout>
那么,如何获得像 “注3” 的结果,在所有的屏幕分辨率?
检查我发布的代码。它会为你工作。 –