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:orientation="horizontal">
<ImageView android:id="@+id/movie_icon"
android:src="@drawable/star_off"
android:layout_height="wrap_content"
android:layout_width="wrap_content"/>
<TextView android:id="@+id/name"
android:textSize="16sp"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_weight="1"
android:gravity="left"
android:textColor="#FFFFFF"
android:textStyle="bold"
android:text="aaaaa"/>
<TextView android:id="@+id/time"
android:textSize="16sp"
android:text="1:25 - 2:25"
android:layout_height="74dip"
android:layout_width="fill_parent"
android:gravity="right"
android:layout_weight="2"
android:background="@drawable/time_background"/>
</LinearLayout>
time and name TextViews have the same width, but I need to have width of time equal to the half width of name. How can I do it? Or, how to create name width fixed (for ex., 100dip)?
Try making both of their widths 0 and set weight=”1″ for the one you want smaller, and weight=”2″ for the one you want bigger. If that doesn’t do it how you want, I am not sure that there is any way to do it without setting a fixed width for them like 100dip as you mentioned.