4

Как обращаться с горизонтальным видом прокрутки для языков R на L. Я добавляю 24 Linear Layout в горизонтальном представлении прокрутки. Он работает для L-R, но не для языков R-L. XML код: Ручка Горизонтальный вид прокрутки для языков R To L

<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 languages.But в R к L Языки, это показать, как enter image description here

Он Прокрутка слева направо направлении, но только 4 раскладок добавлено в Scroll view.After прокрутки слева направо ---> enter image description here

Я хочу добавить 24 макетов в горизонтальной прокрутке просмотра и прокрутка направлении взгляда должен быть справа налево (при R на L языке выбери ред).

+0

try listview.setSelecion (youtlist.size() - 1); –

+0

Прокомментируйте ваш код –

+0

любой удачей с этим? –

ответ

0
<?xml version="1.0" encoding="utf-8"?> 
    <HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
     android:orientation="vertical" 
     android:id = "@+id/hsv" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" > 
    <LinearLayout 
      android:id="@+id/linearLayoutTimeAmPm" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:orientation="horizontal" > 

      <TextView 
       android:layout_width="50dp" 
       android:layout_height="50dp" 
       android:text="A" 
       android:textSize="40sp" /> 
    <TextView 
       android:layout_width="50dp" 
       android:layout_height="50dp" 
       android:text="B" 
       android:textSize="40sp" /> 
    <TextView 
       android:layout_width="50dp" 
       android:layout_height="50dp" 
       android:text="C" 
       android:textSize="40sp" /> 
    <TextView 
       android:layout_width="50dp" 
       android:layout_height="50dp" 
       android:text="D" 
       android:textSize="40sp" /> 
    <TextView 
       android:layout_width="50dp" 
       android:layout_height="50dp" 
       android:text="E" 
       android:textSize="40sp" /> 
    <TextView 
       android:layout_width="50dp" 
       android:layout_height="50dp" 
       android:text="F" 
       android:textSize="40sp" /> 
    <TextView 
       android:layout_width="50dp" 
       android:layout_height="50dp" 
       android:text="G" 
       android:textSize="40sp" /> 
    <TextView 
       android:layout_width="50dp" 
       android:layout_height="50dp" 
       android:text="H" 
       android:textSize="40sp" /> 
    <TextView 
       android:layout_width="50dp" 
       android:layout_height="50dp" 
       android:text="I" 
       android:textSize="40sp" /> 
    <TextView 
       android:layout_width="50dp" 
       android:layout_height="50dp" 
       android:text="J" 
       android:textSize="40sp" /> 
    <TextView 
       android:layout_width="50dp" 
       android:layout_height="50dp" 
       android:text="K" 
       android:textSize="40sp" /> 
     </LinearLayout> 
    </HorizontalScrollView> 

и в вас классе OnCreate добавить

final HorizontalScrollView hsv = (HorizontalScrollView) findViewById(R.id.hsv); 
     new Handler().postDelayed(new Runnable() 
     { 
      public void run() { 
       hsv.fullScroll(HorizontalScrollView.FOCUS_RIGHT); 
      } 
     }, 100L); 

Это образец сделано мной, который работает абсолютно нормально

+0

Он не работает для языка R на L. Я проверил этот код на арабском языке. Он работает только для английского (L-R) языка. – Akashsingla19

+0

Можете ли вы разместить свой код? или любой из арабских вещей, которые вы использовали? –

+0

Я заменил английские алфавиты на ص и س, все работает отлично. –

0

о код Java должен simiular это:

final HorizontalScrollView hsv = (HorizontalScrollView) findViewById(R.id.hsv); 
     new Handler().postDelayed(new Runnable() 
     { 
      public void run() { 
       hsv.fullScroll(HorizontalScrollView.FOCUS_RIGHT); 
      } 
     }, 100L); 

и ваш xml:

<?xml version="1.0" encoding="utf-8"?> 
<HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:id="@+id/hsv" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <ListView 
     android:id="@+id/lvcustomer" 
     android:layout_width="wrap_content" 
     android:layout_height="match_parent" 
     android:divider="@color/colorPrimary" 
     android:dividerHeight="1dp" 
     android:layoutDirection="rtl" /> 

</HorizontalScrollView> 
0

Я стоял лицом к лицу с проблемой Все, что я делал, вместо rtl.! i treid это, и это отлично работает для меня.!

android:layoutDirection="ltr"