现在的位置: 首页 > 综合 > 正文

android Manifest 一些属性

2017年10月09日 ⁄ 综合 ⁄ 共 3974字 ⁄ 字号 评论关闭

http://blog.sina.com.cn/s/blog_57d50de10100q4y0.html

1 同时支持小屏,大屏:在<manifest>中加如下标签。

    <supports-screens android:smallScreens="true"
        android:normalScreens="true" android:largeScreens="true"
        android:anyDensity="true" />

      <uses-sdk android:minSdkVersion="8" /> 

2 自定义权限

<permission android:name="com.jieless.xnote.permission.READ_DATA"
        android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
        android:protectionLevel="normal" />

3 activity的属性“

<activity android:name=".ResourceUI" android:label="@string/app_name"
            android:launchMode="singleInstance" android:theme="@android:style/Theme.NoTitleBar.Fullscreen"

         android:windowSoftInputMode="adjustResize">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

Activity有四种加载模式launchMode:

standard

singleTop

singleTask

singleInstance

b

在AndroidManifest.xml文件中的android:windowSoftInputMode属性使用

 <activity android:windowSoftInputMode=["stateUnspecified",

                                    "stateUnchanged", "stateHidden",

                                    "stateAlwaysHidden", "stateVisible",

                                    "stateAlwaysVisible", "adjustUnspecified",

                                    "adjustResize", "adjustPan"] …… >

</activity>

android:windowSoftInputMode

活动的主窗口如何与包含屏幕上的软键盘窗口交互。这个属性的设置将会影响两件事情:

1>     软键盘的状态——是否它是隐藏或显示——当活动(Activity)成为用户关注的焦点。

2>     活动的主窗口调整——是否减少活动主窗口大小以便腾出空间放软键盘或是否当活动窗口的部分被软键盘覆盖时它的内容的当前焦点是可见的。

它的设置必须是下面列表中的一个值,或一个”state…”值加一个”adjust…”值的组合。在任一组设置多个值——多个”state…”values,例如&mdash有未定义的结果。各个值之间用|分开。例如: <activity android:windowSoftInputMode="stateVisible|adjustResize" . . . >

在这设置的值(除"stateUnspecified"和"adjustUnspecified"以外)将覆盖在主题中设置的值

值 描述
 
"stateUnspecified" 软键盘的状态(是否它是隐藏或可见)没有被指定。系统将选择一个合适的状态或依赖于主题的设置。这个是为了软件盘行为默认的设置。
 
"stateUnchanged" 软键盘被保持无论它上次是什么状态,是否可见或隐藏,当主窗口出现在前面时。
 
"stateHidden" 当用户选择该Activity时,软键盘被隐藏——也就是,当用户确定导航到该Activity时,而不是返回到它由于离开另一个Activity。
 
"stateAlwaysHidden" 软键盘总是被隐藏的,当该Activity主窗口获取焦点时。
 
"stateVisible" 软键盘是可见的,当那个是正常合适的时(当用户导航到Activity主窗口时)。
 
"stateAlwaysVisible" 当用户选择这个Activity时,软键盘是可见的——也就是,也就是,当用户确定导航到该Activity时,而不是返回到它由于离开另一个Activity。
 
"adjustUnspecified" 它不被指定是否该Activity主窗口调整大小以便留出软键盘的空间,或是否窗口上的内容得到屏幕上当前的焦点是可见的。系统将自动选择这些模式中一种主要依赖于是否窗口的内容有任何布局视图能够滚动他们的内容。如果有这样的一个视图,这个窗口将调整大小,这样的假设可以使滚动窗口的内容在一个较小的区域中可见的。这个是主窗口默认的行为设置。
 
"adjustResize" 该Activity主窗口总是被调整屏幕的大小以便留出软键盘的空间。
 
"adjustPan" 该Activity主窗口并不调整屏幕的大小以便留出软键盘的空间。相反,当前窗口的内容将自动移动以便当前焦点从不被键盘覆盖和用户能总是看到输入内容的部分。这个通常是不期望比调整大小,因为用户可能关闭软键盘以便获得与被覆盖内容的交互操作。
 

c

[转载]Activity中ConfigChanges属性的用法

 通过设置这个属性可以使Activity捕捉设备状态变化,以下是可以被识别的内容:  
CONFIG_FONT_SCALE
CONFIG_MCC
CONFIG_MNC
CONFIG_LOCALE
CONFIG_TOUCHSCREEN
CONFIG_KEYBOARD
CONFIG_NAVIGATION
CONFIG_ORIENTATION

设置方法:将下列字段用“|”符号分隔开,例如:“locale|navigation|orientation

Value Description
mcc The IMSI mobile country code (MCC) has changed — that is, a SIM hasbeen detected and updated the MCC.移动国家号码,由三位数字组成,每个国家都有自己独立的MCC,可以识别手机用户所属国家。
mnc The IMSI mobile network code (MNC) has changed — that is, a SIM hasbeen detected and updated the MNC.移动网号,在一个国家或者地区中,用于区分手机用户的服务商。
locale The locale has changed — for example, the user has selected a new language that text should be displayed in.用户所在地区发生变化。
touchscreen The touchscreen has changed. (This should never normally happen.)
keyboard The keyboard type has changed — for example, the user has plugged in an external keyboard.键盘模式发生变化,例如:用户接入外部键盘输入
keyboardHidden The keyboard accessibility has changed — for example, the user has slid the keyboard out to expose it.用户打开手机硬件键盘
navigation The navigation type has changed. (This should never normally happen.)
orientation The screen orientation has changed — that is, the user has rotated the device.设备旋转,横向显示和竖向显示模式切换。
fontScale The font scaling factor has changed — that is, the user has selected a new global font size.全局字体大小缩放发生改变

receiver的一些属性。
<receiver android:name="com.jieless.xnote.note.provider.DocumentReceiver"
            android:enabled="true">
            <intent-filter>
                <action android:name="com.jieless.xnote.doc.delete"></action>
            </intent-filter>
        </receiver>

抱歉!评论已关闭.