Reputation: 338
I have some ImageButton
, that I want to represent user friendly, like here: link to image
.I can't use GridLayout because it supports only sandwich. Main idea is to not have empty space when user rotates screen. Thank you for any suggestions :)
I am right now trying different layouts, like table, relative etc, and trying to find which one would fit my needs, so when user rotates phone there would not be extra white space XML:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
>
<ImageButton
android:id="@+id/min"
android:layout_width="50dp"
android:layout_height="50dp"
android:contentDescription="min.lt_foto"
android:layout_margin="10dp"
android:background="@drawable/min_lt_logo"
android:onClick="IB_min"
/>
<ImageButton
android:id="@+id/VersliLietuva"
android:layout_width="50dp"
android:layout_height="50dp"
android:contentDescription="VersliLietuva"
android:background="@drawable/versli_lietuva"
android:layout_margin="10dp"
android:onClick="IB_VersliLietuva"
/>
<ImageButton
android:id="@+id/ezys"
android:layout_width="50dp"
android:layout_height="50dp"
android:contentDescription="ezys"
android:background="@drawable/ezys"
android:layout_margin="10dp"
android:onClick="IB_ezys"
/>
<ImageButton
android:id="@+id/pienas"
android:layout_width="50dp"
android:layout_height="50dp"
android:contentDescription="pienas"
android:background="@drawable/pienas"
android:layout_margin="10dp"
android:onClick="IB_pienas"
/>
</ScrollView>
Upvotes: 0
Views: 59
Reputation: 4339
Take a look here: http://developer.android.com/guide/topics/ui/layout/gridview.html, there's everything you need to know about grid views (supported starting from API Level 1).
Basically you have to implement your adapter in order to specify the content of each element of the grid. Of course, clicks on items are supported through setOnItemClickListener
.
Upvotes: 1