Android的一些属性----待续

来源:互联网 发布:黑茶网络营销策划 编辑:程序博客网 时间:2024/05/17 23:53

1  让程序竖屏和让程序全屏

<activity android:name=".android"
                  android:theme="@android:style/Theme.NoTitleBar.Fullscreen" //让程序全屏
                   android:screenOrientation="portrait" //让程序竖屏
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

</activity>


2 让程序自适应分辨率

<supports-screens
   android:smallScreens="true"
   android:normalScreens="true"
   android:largeScreens="true"
   android:resizeable="true"
   android:anyDensity="true"
/>
<uses-sdk android:minSdkVersion="7" />//此值大于等于7


3 按钮的三个状态----做个xml放在drawable文件夹下,在mail里面把button背景指向这个xml

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_window_focused="false"
        android:drawable="@drawable/h2" />
        
    <item android:state_pressed="true"
        android:drawable="@drawable/h3" />
        
    <item android:state_focused="true"
        android:drawable="@drawable/h3" />
        
    <item
         android:drawable="@drawable/h2" />
</selector>


4 控件的隐藏属性

android:visibility="invisible"

原创粉丝点击