This example summarizes the use of resource files for Android development. Share to everyone for your reference, specific as follows:
Here are a few of the things that are often used in Android development
Arrays.xml definition Array
Cases:
<resources>
<!--share items-->
<string-array name= "App_share_items" >
<item> Sina Weibo </item>
<item> Tencent micro-blog </item>
</string-array>
</resources>
Solid rounded background
<shape xmlns:android= "Http://schemas.android.com/apk/res/android" >
<solid android:color= "#4a90e2" >
<corners android:radius= "95DP"/>
</shape>
Usage:
android:background= "@drawable/xml_background_button_blue"
The type to get this background is: drawable:gradientdrawable, we can change its color, and keep the background unchanged.
Color related
PS: 0 Transparent, 1 completely impervious
Android: Color format: ARGB alpha:[0,255] completely transparent to completely opaque
Pink: #8f0f
Uses-permission
When you play the window, add in manifest:
<uses-permission android:name= "Android.permission.SYSTEM_ALERT_WINDOW"/>
Correspondence between resource files and classes
Selector corresponds to StateList.
<?xml version= "1.0" encoding= "Utf-8"?> <selector xmlns:android=
"http://schemas.android.com/apk/res/" Android >
<item android:state_pressed= "true" android:drawable= "@drawable/xml_login_button_press"/>
<item android:drawable= "@drawable/xml_login_button_normal"/>
</selector>
<?xml version= "1.0" encoding= "Utf-8"?> <selector xmlns:android=
"http://schemas.android.com/apk/res/" Android ">
<item android:state_pressed=" true ">
<shape>
<solid android:color=" @color /pressed_color "/>
</shape>
</item>
<item>
<shape>
<solid Android:color= "@color/transparent"/>
</shape>
</item>
</selector>
The shape corresponds to the gradientdrawable.
<?xml version= "1.0" encoding= "Utf-8"?> <shape xmlns:android=
"http://schemas.android.com/apk/res/" Android ">
<solid android:color=" #4a90e2 "/>
<corners android:radius=" 95DP "/>
</ Shape>
Notification
1. Action associated with activity
The following two steps are indispensable
step1: Specify an Action constant:
public static final String Download_manager = "Com.james.app.download";
step2: Specify the corresponding intentfilter in the corresponding activity
<intent-filter>
<action android:name= "com.james.app.download"/>
<category android:name= " Android.intent.category.DEFAULT "/>
</intent-filter>
2. The notification is distinguished by action, not by ID.
For more information on Android-related content readers can view the site topics: "Android Resource Operation tips Summary", "Android Development introduction and Advanced Course", "Android Control Usage Summary", "Android SMS and telephone operating skills summary" and " Android Multimedia How-to Summary (audio, video, recording, etc.)
I hope this article will help you with the Android program.