gpt4 book ai didi

android - 处理 R 到 L 语言的水平 ScrollView

转载 作者:太空宇宙 更新时间:2023-11-03 11:09:37 24 4
gpt4 key购买 nike

如何处理 R 到 L 语言的水平 ScrollView 。我在水平 ScrollView 中添加 24 线性布局。它适用于 L 到 R,但不适用于 R 到 L 语言。XML 代码:

    <LinearLayout
android:id="@+id/linearLayoutTimeAmPm"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >

<include
android:id="@+id/linearLayout0Am"
layout="@layout/include_time_textview" />

<include
android:id="@+id/linearLayout1Am"
layout="@layout/include_time_textview" />

<include
android:id="@+id/linearLayout2Am"
layout="@layout/include_time_textview" />

<include
android:id="@+id/linearLayout3Am"
layout="@layout/include_time_textview" />

<include
android:id="@+id/linearLayout4Am"
layout="@layout/include_time_textview" />

<include
android:id="@+id/linearLayout5Am"
layout="@layout/include_time_textview" />

<include
android:id="@+id/linearLayout6Am"
layout="@layout/include_time_textview" />

<include
android:id="@+id/linearLayout7Am"
layout="@layout/include_time_textview" />

<include
android:id="@+id/linearLayout8Am"
layout="@layout/include_time_textview" />

<include
android:id="@+id/linearLayout9Am"
layout="@layout/include_time_textview" />

<include
android:id="@+id/linearLayout10Am"
layout="@layout/include_time_textview" />

<include
android:id="@+id/linearLayout11Am"
layout="@layout/include_time_textview" />

<include
android:id="@+id/linearLayout0Pm"
layout="@layout/include_time_textview" />

<include
android:id="@+id/linearLayout1Pm"
layout="@layout/include_time_textview" />

<include
android:id="@+id/linearLayout2Pm"
layout="@layout/include_time_textview" />

<include
android:id="@+id/linearLayout3Pm"
layout="@layout/include_time_textview" />

<include
android:id="@+id/linearLayout4Pm"
layout="@layout/include_time_textview" />

<include
android:id="@+id/linearLayout5Pm"
layout="@layout/include_time_textview" />

<include
android:id="@+id/linearLayout6Pm"
layout="@layout/include_time_textview" />

<include
android:id="@+id/linearLayout7Pm"
layout="@layout/include_time_textview" />

<include
android:id="@+id/linearLayout8Pm"
layout="@layout/include_time_textview" />

<include
android:id="@+id/linearLayout9Pm"
layout="@layout/include_time_textview" />

<include
android:id="@+id/linearLayout10Pm"
layout="@layout/include_time_textview" />

<include
android:id="@+id/linearLayout11Pm"
layout="@layout/include_time_textview" />
</LinearLayout>
</HorizontalScrollView>

这是在 L 到 R 语言中工作。但是在 R 到 L 语言中,它显示为 enter image description here

它是从左向右滚动,但是在 ScrollView 中只添加了 4 个布局。从左向右滚动后 ---> enter image description here

我想在水平 ScrollView 中添加24个布局, ScrollView 方向应从右到左(选择L语言时)。

最佳答案

我在使用 api 17 的设备上遇到了这个问题。我不小心尝试了这个并且对我来说效果很好:我只是将 android:layoutDirection="ltr" 放在 Horizo​​ntalScrollView 标签中,并将 android:layoutDirection="rtl" 用于它的每个子项(您的 LinearLayout)

关于android - 处理 R 到 L 语言的水平 ScrollView ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27814631/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com