2015-11-09 4 views
0

Пункт табличномGridView: Удаление пробелов между горизонтальными и вертикальными пространствами

<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 т.е. вид сетки (близко друг к другу)

Спасибо заранее

РЕШЕНИЕ

Так я уже понять, как изменить все это, чтобы сделать его НЕТ GAP между ними. и 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

Попробуйте удалять его следующий атрибут:

android:stretchMode="columnWidth" 

Эта проблема встречается там, поэтому, пожалуйста, дайте посмотреть, как хорошо: Which stretchMode to use in GridView on android

Смежные вопросы