Imageview Weights In Linearlayout
I have this layout:
Solution 1:
Use android:weightSum="10" in your case and Use android:background in place of android:src , replace your xml file with this
<TextViewandroid:id="@+id/txt_what_way"android:layout_height="wrap_content"android:layout_width="fill_parent"android:layout_weight="4"android:text="test"android:textAppearance="?android:attr/textAppearanceMedium" /><ImageViewandroid:layout_width="fill_parent"android:layout_height="20dp"android:layout_weight="3"android:background="@drawable/s1"/><ImageViewandroid:layout_width="fill_parent"android:layout_height="20dp"android:layout_weight="3"android:background="@drawable/s1"/></LinearLayout>
You might get distorted image
Solution 2:
This should do it ,although it would distort your image.
<?xml version="1.0" encoding="utf-8"?><LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="wrap_content"android:gravity="center_vertical"android:minWidth="100dp"android:orientation="horizontal" ><TextViewandroid:id="@+id/txt_what_way"android:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="4"android:textAppearance="?android:attr/textAppearanceMedium" /><ImageViewandroid:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="3"android:scaleType="fitCenter"android:src="@drawable/icon" /><ImageViewandroid:layout_width="0dp"android:layout_height="wrap_content"android:layout_weight="3"android:scaleType="fitCenter"android:src="@drawable/icon" /></LinearLayout>
Post a Comment for "Imageview Weights In Linearlayout"