我的结构很简单。滚动视图中的TextView,但是我无法使其按需工作。
我现在遇到的问题;
我得到以下内容:
<HorizontalScrollView
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:layout_gravity="right"
android:background="@drawable/background_scrollviews_display"
android:id="@+id/scrollViewSum">
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="right">
<TextView
style="@style/TextStyleDisplay"
android:textSize="@dimen/fontSizeTextViewSum"
android:paddingLeft="@dimen/paddingDisplayTextViews"
android:paddingRight="@dimen/paddingDisplayTextViews"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="right"
android:gravity="right|center"
android:id="@+id/textViewSum"/>
</LinearLayout>
</HorizontalScrollView>
我想要的是;
我做了很多尝试,但是我根本找不到正确的解决方案。
我希望有人能帮助我!
我有两条线索可以解决您的问题:
1)将LinearLayout方向设置为Vertical,然后可以将TextView定位在右侧
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="right">
<TextView
style="@style/TextStyleDisplay"
android:textSize="@dimen/fontSizeTextViewSum"
android:paddingLeft="@dimen/paddingDisplayTextViews"
android:paddingRight="@dimen/paddingDisplayTextViews"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="right"
android:gravity="right|center"
android:id="@+id/textViewSum"/>
</LinearLayout>
2)使TextView wrap_content代替match_parent
<TextView
style="@style/TextStyleDisplay"
android:textSize="@dimen/fontSizeTextViewSum"
android:paddingLeft="@dimen/paddingDisplayTextViews"
android:paddingRight="@dimen/paddingDisplayTextViews"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="right"
android:gravity="right|center"
android:id="@+id/textViewSum"/>
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句