2016-07-11 10 views
1

Wie man Teiler in GridView so machen? Ich habe nicht genug Bewertung haben Bilder zu schreiben, schauen Sie bitte auf das Bild:Android GridView nicht Standard-Teiler

picture

finde ich nicht Antwort in anderen Fragen zu stackoverflow.com.

Danke.

Antwort

0

Sie haben keinen Beispielcode, ich auch nicht. Lol. Aber wie ich mich daran erinnere, Gridview zu verwenden, ist, dass Sie ein Layout für die Gridview selbst und ein Layout für die Zellen hätten. Um die Zelle Ihrem Bild ähnlich zu machen, würde ich das relative Layout verwenden. Setzen Sie 4 'view' Elemente und eine Textansicht an; 1 Ansicht sollte Attribut align Eltern oben auf wahr, die anderen unten, rechts und links auf wahr haben; textview sollte in der Mitte als true zentriert sein. Dort.

Update: Also versuchen Sie diese Zelle Layout.

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <View 
     android:id="@+id/top" 
     android:layout_width="match_parent" 
     android:layout_height="5dp" 
     android:layout_alignParentTop="true" 
     android:layout_marginLeft="50dp" 
     android:layout_marginRight="50dp" 
     android:background="@android:color/darker_gray" /> 

    <View 
     android:id="@+id/left" 
     android:layout_width="5dp" 
     android:layout_height="match_parent" 
     android:layout_alignParentLeft="true" 
     android:layout_marginBottom="50dp" 
     android:layout_marginTop="50dp" 
     android:background="@android:color/darker_gray" /> 

    <View 
     android:id="@+id/right" 
     android:layout_width="5dp" 
     android:layout_height="match_parent" 
     android:layout_alignParentRight="true" 
     android:layout_marginBottom="50dp" 
     android:layout_marginTop="50dp" 
     android:background="@android:color/darker_gray" /> 

    <View 
     android:id="@+id/bottom" 
     android:layout_width="match_parent" 
     android:layout_height="5dp" 
     android:layout_alignParentBottom="true" 
     android:layout_marginLeft="50dp" 
     android:layout_marginRight="50dp" 
     android:background="@android:color/darker_gray" /> 

    <TextView 
     android:id="@+id/text" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_centerInParent="true" 
     android:text="Item" 
     android:textSize="100sp" /> 


</RelativeLayout> 
+0

Ja, ich versuchte, es zu tun, aber es ist nicht, dass ich will, können Sie es in diesem Bild sehen: http://imgur.com/aoH22QV – promerbay

+0

@promerbay so für die Zelle gegeben Code. Bitte probier es aus. Danke. – klutch