Android layout weight problem -
friends,
i have written following layout code , buttons displayed on screen equally not seems work 1 guide me mistake doing?
![<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" > <linearlayout android:layout_alignparenttop="true" android:layout_centerhorizontal="true" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:background="@color/color_panel_background" > <imagebutton android:layout_height="wrap_content" android:id="@+id/currentlocation" android:layout_weight="1" android:layout_width="fill_parent" android:src="@drawable/current_location_icon" /> <imagebutton android:layout_height="wrap_content" android:id="@+id/searchcity" android:layout_weight="1" android:layout_width="fill_parent" android:src="@drawable/search_icon" /> <imagebutton android:layout_height="wrap_content" android:id="@+id/home" android:layout_weight="1" android:layout_width="fill_parent" android:src="@drawable/home_icon" /> </linearlayout> </relativelayout>][2]
the drawable middle button bigger other two. set height of buttons wrap_content, middle button gets bigger. weight has nothing this. defining how space item takes when use fill_parent. easiest way fix either changing layout_height fixed value (use dp unit) or change size of drawables making images same size begin with.
thumbs way asked question. screenshot , relevant code. wish :)
Comments
Post a Comment