android资源文件的使用(背景选择器,动画等)

为方便以后的使用,直接复制粘贴就OK;
图片背景选择器(drawable文件夹目录):

<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:drawable="@drawable/update_p" android:state_checked="true" android:state_enabled="true"/>
    <item android:drawable="@drawable/update_p" android:state_enabled="true" android:state_pressed="true"/>
    <item android:drawable="@drawable/update_s" android:state_enabled="true" android:state_focused="true"/>
    <item android:drawable="@drawable/update_n" android:state_checked="false" android:state_enabled="true"/>
    <item android:drawable="@drawable/update_d" android:state_enabled="false"/>


selector>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:drawable="@drawable/list_item_p" android:state_pressed="true"/>
    <item android:drawable="@drawable/list_item_p" android:state_selected="true"/>
    <item android:drawable="@drawable/list_item_n" android:state_focused="true"/>
    <item android:drawable="@drawable/list_item_n" android:state_focused="false"/>

selector>

字体颜色背景选择器(color文件夹目录):

<selector
  xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_pressed="true" android:color="@color/button_text_color_p" />
    <item android:state_selected="true" android:color="@color/button_text_color_p" />
    <item android:state_selected="false" android:color="@color/alert_activity_title_black_m" />
    <item android:state_focused="true" android:color="@color/yellow" />
    <item android:state_focused="false" android:color="@color/button_text_color_n" />
selector>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:state_pressed="true" android:color="@color/button_text_color_p"/>
    <item android:state_selected="true" android:color="@color/button_text_color_p"/>
    <item android:state_focused="true" android:color="@color/button_text_color_p"/>
    <item android:state_focused="false" android:color="@color/button_text_color_n"/>

selector>

动画xml资源(anim文件夹目录):


<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:interpolator="@android:anim/decelerate_interpolator"
    android:zAdjustment="top" >

    <scale
        android:duration="@android:integer/config_mediumAnimTime"
        android:fromXScale="1.0"
        android:fromYScale="1.0"
        android:pivotX="50%p"
        android:pivotY="50%p"
        android:toXScale=".5"
        android:toYScale=".5" />

    <alpha
        android:duration="@android:integer/config_mediumAnimTime"
        android:fromAlpha="1.0"
        android:toAlpha="0" />

set>

<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:interpolator="@android:anim/decelerate_interpolator" >

    <scale
        android:duration="@android:integer/config_mediumAnimTime"
        android:fromXScale="2.0"
        android:fromYScale="2.0"
        android:pivotX="50%p"
        android:pivotY="50%p"
        android:toXScale="1.0"
        android:toYScale="1.0" />

set>

颜色定义(values文件夹目录\colors.xml):


<resources>
    <color name="button_text_color_p">#FFEEE000color>
    <color name="button_text_color_n">#ffffffffcolor>
    <color name="alert_activity_title_black_m">#ff525252color>
    <color name="loading_bg">#a0000000color>
    <color name="yellow">#FFEEE000color>
resources>

字符串数组资源(values文件夹目录\):
使用方法:String mFileNames[] = getResources().getStringArray(R.array.file_name);


<resources>

    <string-array name="file_name">
        <item>方向盘item>
        <item>座椅及安全带调节item>
        <item>驾驶模式item>
        <item>智能多媒体item>
        <item>组合仪表item>
        <item>空调item>
        <item>泊车辅助item>
        <item>遥控钥匙item>
        <item>外后视镜调节item>
        <item>雨刮及洗涤item>
        <item>灯光调节item>
    string-array>

resources>

属性资源定义(values文件夹目录\attrs.xml):


<resources>

    <attr name="center_x" format="integer" />
    <attr name="center_y" format="integer" />
    <attr name="circle_r" format="integer" />
    <attr name="scroll_bar" format="integer" />
    <attr name="scroll_item" format="integer" />
    <attr name="scroll_begin" format="float" />
    <attr name="scroll_end" format="float" />
    <attr name="scroll_uid" format="integer" />
    <attr name="copy_scroll_bar" format="integer" />
    <attr name="copy_scroll_item" format="integer" />
    <attr name="copy_scroll_begin_angle" format="float" />
    <attr name="copy_scroll_end_angle" format="float" />

resources>

样式资源定义(values文件夹目录\styles.xml):



    

    

    

    

    

    

    

    

    

    


控件使用ID资源定义(values文件夹目录\ids.xml):

version="1.0" encoding="utf-8"?>

    <item type="id" name="tv_parking_assist">falseitem>
    <item type="id" name="tv_seat_adjustment">falseitem>
    <item type="id" name="tv_intelligent_multimedia">falseitem>
    <item type="id" name="tv_light_adjustment">falseitem>
    <item type="id" name="tv_combination_instrument">falseitem>
    <item type="id" name="tv_drive_model">falseitem>
    <item type="id" name="tv_steering_wheel">falseitem>
    <item type="id" name="tv_remote_key">falseitem>
    <item type="id" name="tv_air_conditioner">falseitem>
    <item type="id" name="tv_wiper_and_wash">falseitem>
    <item type="id" name="tv_exterior_mirror_adjustment">falseitem>
    <item type="id" name="m_surface_view">falseitem>
    <item type="id" name="m_headtext_layout">falseitem>
    <item type="id" name="tv_play_view_headtext">falseitem>
    <item type="id" name="im_play_icon">falseitem>
    <item type="id" name="im_pause_icon">falseitem>
    <item type="id" name="m_seekbar_layout">falseitem>
    <item type="id" name="im_back_to_activity">falseitem>
    <item type="id" name="tv_play_schedule_head">falseitem>
    <item type="id" name="sb_play_seekbar">falseitem>
    <item type="id" name="tv_play_schedule_end">falseitem>
    <item type="id" name="im_back_to_home">falseitem>
    <item type="id" name="spd_item_image">falseitem>
    <item type="id" name="spd_item_text">falseitem>
    <item type="id" name="spd_gv_homeitem">falseitem>

你可能感兴趣的:(Android-view基础,android-资源,资源目录,样式主题,资源动画)