Button
をより下にしたい場合は、次のGridView
ようにします。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
android:orientation="vertical" >
<GridView
android:id="@+id/gridFriends"
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:clipChildren="true"
android:columnWidth="100dp"
android:gravity="center"
android:numColumns="auto_fit"
android:scrollbars="none"
android:stretchMode="columnWidth" >
</GridView>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingBottom="5dp"
android:paddingLeft="9dp"
android:paddingRight="9dp"
android:paddingTop="5dp" >
<ImageButton
android:id="@+id/imgbtnDemo"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center"
android:background="@null"
android:gravity="center"
android:src="@drawable/ic_contact_picture" >
</ImageButton>
</LinearLayout>
</LinearLayout>
Button
のすべてのセルに が必要な場合は、アダプタをGridView
使用するカスタムを使用する必要があります。GridView
のカスタム セルの XML スニペットの例GridView
:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mainContainer"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5dp" >
<FrameLayout
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:gravity="center" >
<ImageView
android:id="@+id/imgProfilePicture"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:adjustViewBounds="true"
android:scaleType="centerCrop"
android:src="@null" />
<ImageButton
android:id="@+id/imgbtnDemo"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center"
android:background="@null"
android:gravity="center"
android:src="@drawable/ic_contact_picture" >
</ImageButton>
</FrameLayout>
</RelativeLayout>
注:投稿の XMLS スニペットでは、ImageButton's
. それらと必要な属性を の属性に変更しますButton
。これは単なる図です。ただし、ドットを接続できるはずです。;-)
カスタムの概念に精通している場合はListViews
、いくつかの変更を加えることで、カスタムも実装できGridView
ます。ListViews
カスタムまたはに慣れていない場合はGridViews
、次のチュートリアルに従ってカスタムを作成する方法を確認してGridView
ください。 .
または、このGoogle 検索を使用して、カスタム に関するその他のチュートリアルを参照してくださいGridView's
。
そして、これは SO に関する私の回答へのリンクです。それは完全な解決策を持っています。目的に合ったロジックを使用してください。