UmBottesWillen
Lurker
Hello, I want to create a TextView of a set size inside a horizontal linear layout, that is scrollable when the content gets too long for the TextView to properly display. Here's the XML structure I am currently using:
This however leads to the TextView elements inside the HorizontalScrollView elements to have their width be set to wrap_content. Manually changing this to match_parent or adding android:fillViewport="true" to the HorizontalScrollView elements did, unlike with normal ScrollView elements, not help.
This is what it looks like in the design view:
The HorizontalScrollView elements already have the correct size, the only issue is that the TextView elements inside of them do not allow their width to be set to match_parent. Is there something I missed?
Code:
<LinearLayout
android:id="@+id/item_bottom
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:weightSum="8">
<HorizontalScrollView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="5"
android:clipToPadding="true"
android:fadeScrollbars="true"
android:scrollbarStyle="insideOverlay"
android:scrollbars="horizontal">
<TextView
android:id="@+id/item_balance"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:fontFamily="sans-serif-black"
android:singleLine="true"
android:text="26677889.44 €"
android:textColor="@android:color/black"
android:textSize="36sp"
android:textStyle="bold" />
</HorizontalScrollView>
<HorizontalScrollView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3"
android:clipToPadding="true"
android:fadeScrollbars="true"
android:scrollbarStyle="insideOverlay"
android:scrollbars="horizontal">
<TextView
android:id="@+id/item_payment"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@color/lightred"
android:gravity="bottom|end"
android:singleLine="true"
android:text="22222"
android:textColor="@android:color/black"
android:textSize="24sp" />
</HorizontalScrollView>
</LinearLayout>
This is what it looks like in the design view:
The HorizontalScrollView elements already have the correct size, the only issue is that the TextView elements inside of them do not allow their width to be set to match_parent. Is there something I missed?