Hello Android Experts,
I have the following layout:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal">
<ImageButton android:id="@+id/ImageButton01"
android:layout_width="80px"
android:layout_height="80px"
android:background="@drawable/projects_badge"
android:layout_margin="10px"/>
<ImageButton android:id="@+id/ImageButton02"
android:layout_width="80px"
android:layout_height="80px"
android:background="@drawable/projects_badge"
android:layout_margin="10px"/>
<ImageButton android:id="@+id/ImageButton01"
android:layout_width="80px"
android:layout_height="80px"
android:background="@drawable/projects_badge"
android:layout_margin="10px"/>
<ImageButton android:id="@+id/ImageButton02"
android:layout_width="80px"
android:layout_height="80px"
android:background="@drawable/projects_badge"
android:layout_margin="10px"/>
<ImageButton android:id="@+id/ImageButton01"
android:layout_width="80px"
android:layout_height="80px"
android:background="@drawable/projects_badge"
android:layout_margin="10px"/>
<ImageButton android:id="@+id/ImageButton02"
android:layout_width="80px"
android:layout_height="80px"
android:background="@drawable/projects_badge"
android:layout_margin="10px"/>
</LinearLayout>
The image buttons of this layout gets out of the screen and become invisible. I would like to start from a new line.
Any help will be appreciated.
Thanks in advance. 🙂
The pixel values of the sum buttons is larger than the pixel value of the screen size, and there is no view in android that will automatically wrap a line. If you want the buttons to go to the next line, you will need to create another layout view and place some of the buttons in there.
You may also want to play with the orientation of the layout(s): http://developer.android.com/reference/android/widget/LinearLayout.html#attr_android:orientation
Also, as a side, you should really be using dp or sp instead of px. What is the difference between "px", "dp", "dip" and "sp" on Android?