I am trying to configure my button layouts and cannot get the structure to properly form. When I run the code on the VM it makes the ImageButton advertisement take up ove fifty percent of the screen despite the weight being only 10%. Each image button references an image stored in drawable-ldpi, and each are roughly 1 KB in size and the activity code is basic with no additions, this is purely graphic interface at the moment through the main xml.
INTENDED LAYOUT:
_______________________
| logo |
|______________________|
| search |
|______________________|
| |
| featured |
| |
|______________________|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
|____|_____|_____|_____|
| advertisement |
|______________________|
ANDROID MAIN.XML CODE:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mainlayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/toplayout"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_weight="45"
android:gravity="top"
android:orientation="vertical" >
<ImageButton
android:id="@+id/mytastelogo"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_weight="15"
android:src="@drawable/mytastelogo_image" />
<ImageButton
android:id="@+id/search"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_weight="10" />
<ImageButton
android:id="@+id/featuredpanel"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_weight="20" />
</LinearLayout>
<LinearLayout
android:id="@+id/bottomlayout"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_weight="45"
android:gravity="bottom"
android:orientation="horizontal" >
<ImageButton
android:id="@+id/mycollection"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:src="@drawable/mycollection_image" />
<ImageButton
android:id="@+id/myrecommendations"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:src="@drawable/myrecommendations_image" />
<ImageButton
android:id="@+id/topitems"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:src="@drawable/topitems_image" />
<ImageButton
android:id="@+id/randomitem"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:src="@drawable/randomitem_image" />
</LinearLayout>
<LinearLayout
android:id="@+id/adlayout"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_weight="10"
android:gravity="end" >
<ImageButton
android:id="@+id/advertisement"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
</LinearLayout>
Try it man 🙂