I have a horizontal LinearLayout
with several TextViews
. As user types some digits into result view, it expands and other TextViews
are getting smaller. I want all TextViews
to have fixed width and hide the first digits when the content is too big. I experimented with surrounding result view with ScrollView
or setMovementMethod(new ScrollingMovementMethod()
) or TableLayout
without luck. SO question
<LinearLayout
android:id="@+id/assignment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="5"
style="@style/Formula">
<TextView
android:id="@+id/operandFirst"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="50"
style="@style/FormulaValue" />
<TextView
android:id="@+id/operator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:text="+"
style="@style/FormulaOperator" />
<TextView
android:id="@+id/operandSecond"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="51"
style="@style/FormulaValue" />
<TextView
android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:text="="
style="@style/FormulaEqualSign" />
<TextView
android:id="@+id/result"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="101"
style="@style/FormulaValue" />
<Space
android:layout_weight="1"
android:layout_width="20dp"
android:layout_height="20dp" />
</LinearLayout>