I have got 3 imageviews. Now what I want to do is to layout one imageview at left, one at center and one at right edge of the screen in a single row. There parent view is Linear layout. How to do it?
<LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content">
<ImageView android:src="@drawable/previous" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="left"></ImageView>
<ImageView android:src="@drawable/play" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" ></ImageView>
<ImageView android:src="@drawable/next" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="right"></ImageView>
</LinearLayout>
Above layout is not working. All images are aligned at the left.
The best option would be to use wieghts. Set the layout_width to 0dp for each ImageView. Then set the layout_weight value to be equal on echt view. F.e. set it to 1.
For more information about weights: http://android.amberfog.com/?p=328