I am working on a project. I am required to make a TextView
to be fit into 1 line (as shown below).
But after I tried adjusting layout_weight, it fails.
Here is my code (with original layout_weight):
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tool="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="@layout/view_toolbar" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/appbar"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_horizontal"
android:orientation="vertical"
android:padding="25dp">
(omitted)
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/padding_small"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:textAppearance="?android:attr/textAppearanceListItemSmall">
<TextView
android:id="@+id/hose_expired_count"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/padding_x_larger"
android:layout_weight="1"
android:textColor="@color/textColor_dark"
android:textSize="@dimen/font_size_medium" />
<TextView
android:id="@+id/hose_expired_count_amount"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/padding_larger"
android:layout_weight=".5"
android:textColor="@color/textColor_dark"
android:textSize="@dimen/font_size_medium" />
</LinearLayout>
(omitted)
</LinearLayout>
(omitted)
</LinearLayout>
</RelativeLayout>
How can I fix the layout_weight
(and possibly width, height, etc.) so that I can get the TextView
fitted?