一个demo掌握Android Manifest文件的android:supportsRtl="true"属性(7.22)
2017-07-19 10:39
302 查看
supportsRtl ==> supports right to lift
是否支持 从右到左的布局(主要是方便从右到左的阅读习惯)
官网注解 :
Declares whether your application is willing to support right-to-left (RTL) layouts.
If set to
or higher, various RTL APIs will be activated and used by the system so your app can display RTL layouts. If set to
set to 16 or lower, the RTL APIs will be ignored or will have no effect and your app will behave the same regardless of the layout direction associated to the user's Locale choice (your layouts will always be left-to-right).
The default value of this attribute is
This attribute was added in API level 17.
开发者选项中的开关如下 :
![](https://img-blog.csdn.net/20170719104536884?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQval9ob2x5/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
布局代码如下:
开关关闭时效果 :
![](https://img-blog.csdn.net/20170719103909904?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQval9ob2x5/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
开关打开时效果 (manifest application 设置 android:supportsRtl="true")
是否支持 从右到左的布局(主要是方便从右到左的阅读习惯)
官网注解 :
Declares whether your application is willing to support right-to-left (RTL) layouts.
If set to
trueand
targetSdkVersionis set to 17
or higher, various RTL APIs will be activated and used by the system so your app can display RTL layouts. If set to
falseor if
targetSdkVersionis
set to 16 or lower, the RTL APIs will be ignored or will have no effect and your app will behave the same regardless of the layout direction associated to the user's Locale choice (your layouts will always be left-to-right).
The default value of this attribute is
false.
This attribute was added in API level 17.
开发者选项中的开关如下 :
布局代码如下:
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:context="com.ufotosoft.demo.MainActivity"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="LinearLayout" /> <LinearLayout android:layout_width="match_parent" android:layout_height="30dp" android:orientation="horizontal" android:background="#f5dfc5"> <TextView android:layout_width="30dp" android:layout_height="match_parent" android:background="#ef8057" android:text="1" /> <TextView android:layout_width="30dp" android:layout_height="match_parent" android:background="#efbf57" android:text="2" /> <TextView android:layout_width="30dp" android:layout_height="match_parent" android:background="#efe757" android:text="3" /> <TextView android:layout_width="30dp" android:layout_height="match_parent" android:background="#85ef57" android:text="4" /> </LinearLayout> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="LinearLayout gravity right" /> <LinearLayout android:layout_width="match_parent" android:layout_height="30dp" android:orientation="horizontal" android:gravity="right" android:background="#f5dfc5"> <TextView android:layout_width="30dp" android:layout_height="match_parent" android:background="#ef8057" android:text="1" /> <TextView android:layout_width="30dp" android:layout_height="match_parent" android:background="#efbf57" android:text="2" /> <TextView android:layout_width="30dp" android:layout_height="match_parent" android:background="#efe757" android:text="3" /> <TextView android:layout_width="30dp" android:layout_height="match_parent" android:background="#85ef57" android:text="4" /> </LinearLayout> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="RelativeLayout" /> <RelativeLayout android:layout_width="match_parent" android:layout_height="70dp" android:background="#f5dfc5"> <TextView android:layout_width="30dp" android:layout_height="30dp" android:layout_alignParentTop="true" android:layout_alignParentLeft="true" android:background="#ef8057" android:text="1" /> <TextView android:layout_width="30dp" android:layout_height="30dp" android:layout_alignParentTop="true" android:layout_alignParentRight="true" android:background="#efbf57" android:text="2" /> <TextView android:layout_width="30dp" android:layout_height="30dp" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" android:background="#efe757" android:text="3" /> <TextView android:layout_width="30dp" android:layout_height="30dp" android:layout_alignParentBottom="true" android:layout_alignParentRight="true" android:background="#85ef57" android:text="4" /> </RelativeLayout> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="FrameLayout" /> <FrameLayout android:layout_width="match_parent" android:layout_height="50dp" android:background="#f5dfc5"> <TextView android:layout_width="30dp" android:layout_height="30dp" android:layout_alignParentTop="true" android:layout_alignParentLeft="true" android:background="#ef8057" android:text="1" /> </FrameLayout> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="TableLayout" /> <TableLayout android:layout_width="match_parent" android:layout_height="100dp"> <TextView android:layout_width="30dp" android:layout_height="30dp" android:layout_alignParentTop="true" android:layout_alignParentLeft="true" android:background="#ef8057" android:text="1" /> <TextView android:layout_width="30dp" android:layout_height="30dp" android:layout_alignParentTop="true" android:layout_alignParentRight="true" android:background="#efbf57" android:text="2" /> <TextView android:layout_width="30dp" android:layout_height="30dp" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" android:background="#efe757" android:text="3" /> </TableLayout> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="GridLayout" /> <GridLayout android:layout_width="match_parent" android:layout_height="100dp" android:columnCount="3" android:rowCount="3" > <TextView android:layout_width="100dp" android:layout_height="30dp" android:layout_alignParentTop="true" android:layout_alignParentLeft="true" android:background="#ef8057" android:text="1" /> <TextView android:layout_width="100dp" android:layout_height="30dp" android:layout_alignParentTop="true" android:layout_alignParentRight="true" android:background="#efbf57" android:text="2" /> <TextView android:layout_width="100dp" android:layout_height="30dp" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" android:background="#efe757" android:text="3" /> <TextView android:layout_width="100dp" android:layout_height="30dp" android:layout_alignParentBottom="true" android:layout_alignParentRight="true" android:background="#85ef57" android:text="4" /> <TextView android:layout_width="100dp" android:layout_height="30dp" android:layout_alignParentTop="true" android:layout_alignParentLeft="true" android:background="#ef8057" android:text="5" /> <TextView android:layout_width="100dp" android:layout_height="30dp" android:layout_alignParentTop="true" android:layout_alignParentRight="true" android:background="#efbf57" android:text="6" /> <TextView android:layout_width="100dp" android:layout_height="30dp" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" android:background="#efe757" android:text="7" /> <TextView android:layout_width="100dp" android:layout_height="30dp" android:layout_alignParentBottom="true" android:layout_alignParentRight="true" android:background="#85ef57" android:text="8" /> </GridLayout> </LinearLayout>
开关关闭时效果 :
开关打开时效果 (manifest application 设置 android:supportsRtl="true")
相关文章推荐
- android:supportsRtl="true" 属性
- android:supportsRtl="true"
- 设置android:supportsRtl="true"无效问题
- AndroidManifest文件中属性<application android:allowBackup="false">
- 设置android:supportsRtl="true"无效问题
- 在AndroidManifest.xml文件中的android:windowSoftInputMode属性使用
- AndroidManifest文件中android属性
- 在AndroidManifest.xml文件中的android:windowSoftInputMode属性使用
- 一个Demo让你掌握所有的android控件
- 一个Demo让你掌握所有的android控件
- 一个Demo让你掌握所有的android控件
- 一个由Activity launchMode="singleTask"属性引起的血案(Android)
- Hibernate实体类映射文件demo.hbm.xml 中的<generator class="?"></generator>的不同属性含义
- 一个Demo让你掌握所有的android控件
- 一个Demo让你掌握所有的android控件
- Android系统开发 - 扩展Androidmanifest.xml文件中<application>标签的属性
- 在AndroidManifest.xml文件中<activity>的android:windowSoftInputMode属性使用
- android Manifest.xml全局配置文件中根标签中package属性及<original-package>标签注意点
- Android 获取AndroidManifest.xml文件versionCode,versionName属性
- android很好的一篇文章,关于AndroidManifest.xml文件各个属性,补补基础