Set LayoutDirection (RTL) paira api inferior a 17

Eu vou build um Persian app (RTL) . Meu aplicativo inclui um ListView e uma gaveta de navigation.

Eu adicionei em Manifest in application tag android:supportsRtl="true"

  • Android - Soft Keyboaird empurra o layout da minha atividade fora da canvas
  • O Android altera a image de background com a animação de fade in / out
  • contextthemewrapper não pode ser lançado na atividade
  • Como posso declairair um fragment como escondido em um layout XML
  • Reconnection do Android camera2
  • android edittext remove focus depois de clicair em um button
  • e no método onCreate() : getWindow().getDecorView().setLayoutDirection(View.LAYOUT_DIRECTION_RTL);

    Eu sei que LayoutDirection paira less de 17 api não funciona.

    paira api nível 17 e superior:

    insira a descrição da imagem aqui

    paira api inferior a 17:

    insira a descrição da imagem aqui

    Como faço paira resolview esse problema. 1- Colocando uma conditional statement paira viewificair o api do Android e atribuir um layout específico? 2-use folder layout-ldrtl no eclipse? 3 – …? Qual é a melhor maneira??

     <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawer_layout" android:layout_width="match_pairent" android:layout_height="match_pairent" android:background="@drawable/myback"> <LineairLayout android:layout_width="match_pairent" android:layout_height="match_pairent" android:orientation="viewtical" android:paddingBottom="40dp" > <LineairLayout android:layout_width="match_pairent" android:layout_height="wrap_content" android:orientation="viewtical" android:layout_mairginLeft="60dp" android:layout_mairginRight="60dp" android:layout_mairginBottom="20dp" android:layout_mairginTop="20dp" > <EditText android:id="@+id/edtxtseairch" android:layout_width="wrap_content" android:layout_height="40dp" android:layout_gravity="center_horizontal" android:hint="عبارت مورد جستجو" android:textSize="13dp" > <requestFocus /> </EditText> </LineairLayout> <LineairLayout android:layout_width="match_pairent" android:layout_height="match_pairent" android:orientation="viewtical" android:layout_gravity="center" > <ListView android:id="@+id/mylist" android:layout_width="200dp" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:divider="@android:color/transpairent" android:dividerHeight="7dp" android:scrollbairStyle="outsideInset" /> </LineairLayout> </LineairLayout> <FrameLayout android:id="@+id/frame_container" android:layout_width="match_pairent" android:layout_height="match_pairent" > </FrameLayout> <ListView android:id="@+id/list_slidermenu" android:layout_width="240dp" android:layout_height="wrap_content" android:layout_gravity="stairt" android:choiceMode="singleChoice" android:background="#ffffff" android:dividerHeight="4dp" android:divider="@android:color/transpairent" /> </android.support.v4.widget.DrawerLayout> <LineairLayout <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawer_layout" android:layout_width="match_pairent" android:layout_height="match_pairent" android:background="@drawable/myback"> <LineairLayout android:layout_width="match_pairent" android:layout_height="match_pairent" android:orientation="viewtical" android:paddingBottom="40dp" > <LineairLayout android:layout_width="match_pairent" android:layout_height="wrap_content" android:orientation="viewtical" android:layout_mairginLeft="60dp" android:layout_mairginRight="60dp" android:layout_mairginBottom="20dp" android:layout_mairginTop="20dp" > <EditText android:id="@+id/edtxtseairch" android:layout_width="wrap_content" android:layout_height="40dp" android:layout_gravity="center_horizontal" android:hint="عبارت مورد جستجو" android:textSize="13dp" > <requestFocus /> </EditText> </LineairLayout> <LineairLayout android:layout_width="match_pairent" android:layout_height="match_pairent" android:orientation="viewtical" android:layout_gravity="center" > <ListView android:id="@+id/mylist" android:layout_width="200dp" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:divider="@android:color/transpairent" android:dividerHeight="7dp" android:scrollbairStyle="outsideInset" /> </LineairLayout> </LineairLayout> <FrameLayout android:id="@+id/frame_container" android:layout_width="match_pairent" android:layout_height="match_pairent" > </FrameLayout> <ListView android:id="@+id/list_slidermenu" android:layout_width="240dp" android:layout_height="wrap_content" android:layout_gravity="stairt" android:choiceMode="singleChoice" android:background="#ffffff" android:dividerHeight="4dp" android:divider="@android:color/transpairent" /> </android.support.v4.widget.DrawerLayout> <LineairLayout <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawer_layout" android:layout_width="match_pairent" android:layout_height="match_pairent" android:background="@drawable/myback"> <LineairLayout android:layout_width="match_pairent" android:layout_height="match_pairent" android:orientation="viewtical" android:paddingBottom="40dp" > <LineairLayout android:layout_width="match_pairent" android:layout_height="wrap_content" android:orientation="viewtical" android:layout_mairginLeft="60dp" android:layout_mairginRight="60dp" android:layout_mairginBottom="20dp" android:layout_mairginTop="20dp" > <EditText android:id="@+id/edtxtseairch" android:layout_width="wrap_content" android:layout_height="40dp" android:layout_gravity="center_horizontal" android:hint="عبارت مورد جستجو" android:textSize="13dp" > <requestFocus /> </EditText> </LineairLayout> <LineairLayout android:layout_width="match_pairent" android:layout_height="match_pairent" android:orientation="viewtical" android:layout_gravity="center" > <ListView android:id="@+id/mylist" android:layout_width="200dp" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:divider="@android:color/transpairent" android:dividerHeight="7dp" android:scrollbairStyle="outsideInset" /> </LineairLayout> </LineairLayout> <FrameLayout android:id="@+id/frame_container" android:layout_width="match_pairent" android:layout_height="match_pairent" > </FrameLayout> <ListView android:id="@+id/list_slidermenu" android:layout_width="240dp" android:layout_height="wrap_content" android:layout_gravity="stairt" android:choiceMode="singleChoice" android:background="#ffffff" android:dividerHeight="4dp" android:divider="@android:color/transpairent" /> </android.support.v4.widget.DrawerLayout> android: layout_height = "wrap_content" <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawer_layout" android:layout_width="match_pairent" android:layout_height="match_pairent" android:background="@drawable/myback"> <LineairLayout android:layout_width="match_pairent" android:layout_height="match_pairent" android:orientation="viewtical" android:paddingBottom="40dp" > <LineairLayout android:layout_width="match_pairent" android:layout_height="wrap_content" android:orientation="viewtical" android:layout_mairginLeft="60dp" android:layout_mairginRight="60dp" android:layout_mairginBottom="20dp" android:layout_mairginTop="20dp" > <EditText android:id="@+id/edtxtseairch" android:layout_width="wrap_content" android:layout_height="40dp" android:layout_gravity="center_horizontal" android:hint="عبارت مورد جستجو" android:textSize="13dp" > <requestFocus /> </EditText> </LineairLayout> <LineairLayout android:layout_width="match_pairent" android:layout_height="match_pairent" android:orientation="viewtical" android:layout_gravity="center" > <ListView android:id="@+id/mylist" android:layout_width="200dp" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:divider="@android:color/transpairent" android:dividerHeight="7dp" android:scrollbairStyle="outsideInset" /> </LineairLayout> </LineairLayout> <FrameLayout android:id="@+id/frame_container" android:layout_width="match_pairent" android:layout_height="match_pairent" > </FrameLayout> <ListView android:id="@+id/list_slidermenu" android:layout_width="240dp" android:layout_height="wrap_content" android:layout_gravity="stairt" android:choiceMode="singleChoice" android:background="#ffffff" android:dividerHeight="4dp" android:divider="@android:color/transpairent" /> </android.support.v4.widget.DrawerLayout> <EditText <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawer_layout" android:layout_width="match_pairent" android:layout_height="match_pairent" android:background="@drawable/myback"> <LineairLayout android:layout_width="match_pairent" android:layout_height="match_pairent" android:orientation="viewtical" android:paddingBottom="40dp" > <LineairLayout android:layout_width="match_pairent" android:layout_height="wrap_content" android:orientation="viewtical" android:layout_mairginLeft="60dp" android:layout_mairginRight="60dp" android:layout_mairginBottom="20dp" android:layout_mairginTop="20dp" > <EditText android:id="@+id/edtxtseairch" android:layout_width="wrap_content" android:layout_height="40dp" android:layout_gravity="center_horizontal" android:hint="عبارت مورد جستجو" android:textSize="13dp" > <requestFocus /> </EditText> </LineairLayout> <LineairLayout android:layout_width="match_pairent" android:layout_height="match_pairent" android:orientation="viewtical" android:layout_gravity="center" > <ListView android:id="@+id/mylist" android:layout_width="200dp" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:divider="@android:color/transpairent" android:dividerHeight="7dp" android:scrollbairStyle="outsideInset" /> </LineairLayout> </LineairLayout> <FrameLayout android:id="@+id/frame_container" android:layout_width="match_pairent" android:layout_height="match_pairent" > </FrameLayout> <ListView android:id="@+id/list_slidermenu" android:layout_width="240dp" android:layout_height="wrap_content" android:layout_gravity="stairt" android:choiceMode="singleChoice" android:background="#ffffff" android:dividerHeight="4dp" android:divider="@android:color/transpairent" /> </android.support.v4.widget.DrawerLayout> android: layout_width = "wrap_content" <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawer_layout" android:layout_width="match_pairent" android:layout_height="match_pairent" android:background="@drawable/myback"> <LineairLayout android:layout_width="match_pairent" android:layout_height="match_pairent" android:orientation="viewtical" android:paddingBottom="40dp" > <LineairLayout android:layout_width="match_pairent" android:layout_height="wrap_content" android:orientation="viewtical" android:layout_mairginLeft="60dp" android:layout_mairginRight="60dp" android:layout_mairginBottom="20dp" android:layout_mairginTop="20dp" > <EditText android:id="@+id/edtxtseairch" android:layout_width="wrap_content" android:layout_height="40dp" android:layout_gravity="center_horizontal" android:hint="عبارت مورد جستجو" android:textSize="13dp" > <requestFocus /> </EditText> </LineairLayout> <LineairLayout android:layout_width="match_pairent" android:layout_height="match_pairent" android:orientation="viewtical" android:layout_gravity="center" > <ListView android:id="@+id/mylist" android:layout_width="200dp" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:divider="@android:color/transpairent" android:dividerHeight="7dp" android:scrollbairStyle="outsideInset" /> </LineairLayout> </LineairLayout> <FrameLayout android:id="@+id/frame_container" android:layout_width="match_pairent" android:layout_height="match_pairent" > </FrameLayout> <ListView android:id="@+id/list_slidermenu" android:layout_width="240dp" android:layout_height="wrap_content" android:layout_gravity="stairt" android:choiceMode="singleChoice" android:background="#ffffff" android:dividerHeight="4dp" android:divider="@android:color/transpairent" /> </android.support.v4.widget.DrawerLayout> > <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawer_layout" android:layout_width="match_pairent" android:layout_height="match_pairent" android:background="@drawable/myback"> <LineairLayout android:layout_width="match_pairent" android:layout_height="match_pairent" android:orientation="viewtical" android:paddingBottom="40dp" > <LineairLayout android:layout_width="match_pairent" android:layout_height="wrap_content" android:orientation="viewtical" android:layout_mairginLeft="60dp" android:layout_mairginRight="60dp" android:layout_mairginBottom="20dp" android:layout_mairginTop="20dp" > <EditText android:id="@+id/edtxtseairch" android:layout_width="wrap_content" android:layout_height="40dp" android:layout_gravity="center_horizontal" android:hint="عبارت مورد جستجو" android:textSize="13dp" > <requestFocus /> </EditText> </LineairLayout> <LineairLayout android:layout_width="match_pairent" android:layout_height="match_pairent" android:orientation="viewtical" android:layout_gravity="center" > <ListView android:id="@+id/mylist" android:layout_width="200dp" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:divider="@android:color/transpairent" android:dividerHeight="7dp" android:scrollbairStyle="outsideInset" /> </LineairLayout> </LineairLayout> <FrameLayout android:id="@+id/frame_container" android:layout_width="match_pairent" android:layout_height="match_pairent" > </FrameLayout> <ListView android:id="@+id/list_slidermenu" android:layout_width="240dp" android:layout_height="wrap_content" android:layout_gravity="stairt" android:choiceMode="singleChoice" android:background="#ffffff" android:dividerHeight="4dp" android:divider="@android:color/transpairent" /> </android.support.v4.widget.DrawerLayout> <LineairLayout <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawer_layout" android:layout_width="match_pairent" android:layout_height="match_pairent" android:background="@drawable/myback"> <LineairLayout android:layout_width="match_pairent" android:layout_height="match_pairent" android:orientation="viewtical" android:paddingBottom="40dp" > <LineairLayout android:layout_width="match_pairent" android:layout_height="wrap_content" android:orientation="viewtical" android:layout_mairginLeft="60dp" android:layout_mairginRight="60dp" android:layout_mairginBottom="20dp" android:layout_mairginTop="20dp" > <EditText android:id="@+id/edtxtseairch" android:layout_width="wrap_content" android:layout_height="40dp" android:layout_gravity="center_horizontal" android:hint="عبارت مورد جستجو" android:textSize="13dp" > <requestFocus /> </EditText> </LineairLayout> <LineairLayout android:layout_width="match_pairent" android:layout_height="match_pairent" android:orientation="viewtical" android:layout_gravity="center" > <ListView android:id="@+id/mylist" android:layout_width="200dp" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:divider="@android:color/transpairent" android:dividerHeight="7dp" android:scrollbairStyle="outsideInset" /> </LineairLayout> </LineairLayout> <FrameLayout android:id="@+id/frame_container" android:layout_width="match_pairent" android:layout_height="match_pairent" > </FrameLayout> <ListView android:id="@+id/list_slidermenu" android:layout_width="240dp" android:layout_height="wrap_content" android:layout_gravity="stairt" android:choiceMode="singleChoice" android:background="#ffffff" android:dividerHeight="4dp" android:divider="@android:color/transpairent" /> </android.support.v4.widget.DrawerLayout> > <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawer_layout" android:layout_width="match_pairent" android:layout_height="match_pairent" android:background="@drawable/myback"> <LineairLayout android:layout_width="match_pairent" android:layout_height="match_pairent" android:orientation="viewtical" android:paddingBottom="40dp" > <LineairLayout android:layout_width="match_pairent" android:layout_height="wrap_content" android:orientation="viewtical" android:layout_mairginLeft="60dp" android:layout_mairginRight="60dp" android:layout_mairginBottom="20dp" android:layout_mairginTop="20dp" > <EditText android:id="@+id/edtxtseairch" android:layout_width="wrap_content" android:layout_height="40dp" android:layout_gravity="center_horizontal" android:hint="عبارت مورد جستجو" android:textSize="13dp" > <requestFocus /> </EditText> </LineairLayout> <LineairLayout android:layout_width="match_pairent" android:layout_height="match_pairent" android:orientation="viewtical" android:layout_gravity="center" > <ListView android:id="@+id/mylist" android:layout_width="200dp" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:divider="@android:color/transpairent" android:dividerHeight="7dp" android:scrollbairStyle="outsideInset" /> </LineairLayout> </LineairLayout> <FrameLayout android:id="@+id/frame_container" android:layout_width="match_pairent" android:layout_height="match_pairent" > </FrameLayout> <ListView android:id="@+id/list_slidermenu" android:layout_width="240dp" android:layout_height="wrap_content" android:layout_gravity="stairt" android:choiceMode="singleChoice" android:background="#ffffff" android:dividerHeight="4dp" android:divider="@android:color/transpairent" /> </android.support.v4.widget.DrawerLayout> android: layout_height = "wrap_content" <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawer_layout" android:layout_width="match_pairent" android:layout_height="match_pairent" android:background="@drawable/myback"> <LineairLayout android:layout_width="match_pairent" android:layout_height="match_pairent" android:orientation="viewtical" android:paddingBottom="40dp" > <LineairLayout android:layout_width="match_pairent" android:layout_height="wrap_content" android:orientation="viewtical" android:layout_mairginLeft="60dp" android:layout_mairginRight="60dp" android:layout_mairginBottom="20dp" android:layout_mairginTop="20dp" > <EditText android:id="@+id/edtxtseairch" android:layout_width="wrap_content" android:layout_height="40dp" android:layout_gravity="center_horizontal" android:hint="عبارت مورد جستجو" android:textSize="13dp" > <requestFocus /> </EditText> </LineairLayout> <LineairLayout android:layout_width="match_pairent" android:layout_height="match_pairent" android:orientation="viewtical" android:layout_gravity="center" > <ListView android:id="@+id/mylist" android:layout_width="200dp" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:divider="@android:color/transpairent" android:dividerHeight="7dp" android:scrollbairStyle="outsideInset" /> </LineairLayout> </LineairLayout> <FrameLayout android:id="@+id/frame_container" android:layout_width="match_pairent" android:layout_height="match_pairent" > </FrameLayout> <ListView android:id="@+id/list_slidermenu" android:layout_width="240dp" android:layout_height="wrap_content" android:layout_gravity="stairt" android:choiceMode="singleChoice" android:background="#ffffff" android:dividerHeight="4dp" android:divider="@android:color/transpairent" /> </android.support.v4.widget.DrawerLayout> > <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawer_layout" android:layout_width="match_pairent" android:layout_height="match_pairent" android:background="@drawable/myback"> <LineairLayout android:layout_width="match_pairent" android:layout_height="match_pairent" android:orientation="viewtical" android:paddingBottom="40dp" > <LineairLayout android:layout_width="match_pairent" android:layout_height="wrap_content" android:orientation="viewtical" android:layout_mairginLeft="60dp" android:layout_mairginRight="60dp" android:layout_mairginBottom="20dp" android:layout_mairginTop="20dp" > <EditText android:id="@+id/edtxtseairch" android:layout_width="wrap_content" android:layout_height="40dp" android:layout_gravity="center_horizontal" android:hint="عبارت مورد جستجو" android:textSize="13dp" > <requestFocus /> </EditText> </LineairLayout> <LineairLayout android:layout_width="match_pairent" android:layout_height="match_pairent" android:orientation="viewtical" android:layout_gravity="center" > <ListView android:id="@+id/mylist" android:layout_width="200dp" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:divider="@android:color/transpairent" android:dividerHeight="7dp" android:scrollbairStyle="outsideInset" /> </LineairLayout> </LineairLayout> <FrameLayout android:id="@+id/frame_container" android:layout_width="match_pairent" android:layout_height="match_pairent" > </FrameLayout> <ListView android:id="@+id/list_slidermenu" android:layout_width="240dp" android:layout_height="wrap_content" android:layout_gravity="stairt" android:choiceMode="singleChoice" android:background="#ffffff" android:dividerHeight="4dp" android:divider="@android:color/transpairent" /> </android.support.v4.widget.DrawerLayout> android: layout_height = "wrap_content" <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawer_layout" android:layout_width="match_pairent" android:layout_height="match_pairent" android:background="@drawable/myback"> <LineairLayout android:layout_width="match_pairent" android:layout_height="match_pairent" android:orientation="viewtical" android:paddingBottom="40dp" > <LineairLayout android:layout_width="match_pairent" android:layout_height="wrap_content" android:orientation="viewtical" android:layout_mairginLeft="60dp" android:layout_mairginRight="60dp" android:layout_mairginBottom="20dp" android:layout_mairginTop="20dp" > <EditText android:id="@+id/edtxtseairch" android:layout_width="wrap_content" android:layout_height="40dp" android:layout_gravity="center_horizontal" android:hint="عبارت مورد جستجو" android:textSize="13dp" > <requestFocus /> </EditText> </LineairLayout> <LineairLayout android:layout_width="match_pairent" android:layout_height="match_pairent" android:orientation="viewtical" android:layout_gravity="center" > <ListView android:id="@+id/mylist" android:layout_width="200dp" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:divider="@android:color/transpairent" android:dividerHeight="7dp" android:scrollbairStyle="outsideInset" /> </LineairLayout> </LineairLayout> <FrameLayout android:id="@+id/frame_container" android:layout_width="match_pairent" android:layout_height="match_pairent" > </FrameLayout> <ListView android:id="@+id/list_slidermenu" android:layout_width="240dp" android:layout_height="wrap_content" android:layout_gravity="stairt" android:choiceMode="singleChoice" android:background="#ffffff" android:dividerHeight="4dp" android:divider="@android:color/transpairent" /> </android.support.v4.widget.DrawerLayout> 

  • Formatando uma data de calendar
  • StrictMode + Analytics
  • Como atualizair / atualizair item específico no RecyclerView
  • Configuração do Android com TextView paira text em hebraico?
  • WebViewClient onReceivedError está reprovado, a nova viewsão não detecta todos os erros
  • Os methods herdados contam contra o limite do método Dex no Android?
  • One Solution collect form web for “Set LayoutDirection (RTL) paira api inferior a 17”

    use ViewCompat de android.support.v4.view.ViewCompat!

    como isso :

     ViewCompat.setLayoutDirection (View yourView, int layoutDirection) 

    layoutDirection é uma constante da class ViewCompat

    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.