Елемент подання сітки
<com.android.volley.toolbox.NetworkImageView
android:id="@+id/iconGrid"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_gravity="center_horizontal"
android:adjustViewBounds="true"/>
Макет подання сітки
<GridView
android:id="@+id/gridView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:listSelector="#80AD3B6D"
android:verticalSpacing="0dp"
android:horizontalSpacing="0dp"
android:stretchMode="columnWidth"
android:numColumns="3">
</GridView>
З певних причин у вигляд сітки все ще є пробілиміж ними, і я спробую все можливе рішення, але все ще не в змозі це зробити. Якось є пробіл на кожній стороні зображення (елемента). І все, що я хочу, - це зробити всі зображення без проміжку між ними. тобто перегляд сітки instagram (близько один до одного)
Заздалегідь спасибі
РІШЕННЯ
Тож я вже розумію, як змінити це все, щоб воно не було між ними. і Gridview.xml залишаються колишніми.
Це буде items.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<FrameLayout
android:layout_width="wrap_content"
android:background="#000000"
android:layout_height="wrap_content">
<com.android.volley.toolbox.NetworkImageView
android:id="@+id/iconGrid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:scaleType="fitXY"
android:adjustViewBounds="true"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="right|bottom"
android:padding="2dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/like"
android:layout_width="15dp"
android:layout_height="15dp"
android:src="@drawable/hwhite"
android:visibility="invisible" />
<TextView
android:id="@+id/num"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom|right"
android:text="121"
android:textColor="#FFFFFF"
android:visibility="invisible" />
</LinearLayout>
</FrameLayout>
</LinearLayout>
Відповіді:
0 для відповіді № 1Спробуйте видалити такий атрибут:
android:stretchMode="columnWidth"
З цією проблемою виникла проблема, тому, будь ласка, подивіться також: Який stretchMode використовувати в GridView на android