(1) for complex XML authoring interfaces, using include will make writing and viewing clearer
<linearlayout
android:layout_width= "match_parent"
android:layout_height= "match_parent"
Android:o rientation= "vertical"
;
<include android:id= "@+id/hi1" layout= "@layout/health_info1"/>
<include android:id= "@+id/hi2" layout= "@layout/health_info2"/>
<include android:id= "@+id/hi3" layout= "@layout/health_info3"/>
<include android:id= "@+id/hi4" layout= "@layout/health_info4"/>
<include android:id= "@+id/hi5" layout= "@layout/health_info5"/>
</LINEARLAYOUT>
Here Health_info1 to Health_info5 is 5 layout files, corresponding to the interface of 5 modules, each module 200 rows or so, assuming that in a separate module, whether the change or view is relatively easy, assuming that the include is not available, The entire layout file is about 1000 rows. Whether it's a change or a view is a hassle, similar to a call to a function in your code.
CheckBox hiCbPs1;
hicbps1= (CheckBox) Findviewbyid (R.ID.HI1). Findviewbyid (R.ID.HICBPS1);
This is how you use it in your code
(2) Define the use of the view yourself. In the development of products, sometimes encountered some need to draw their own view added to the interface
How to add to XML
<com.jxj.view.bigdialview
Android:id= "@+id/healthstatedial"
Android:layout_width= "Fill_parent"
android:layout_height= "200dip"
Android:layout_margin= "5dip"
android:layout_gravity= "Center"
Android:scaletype= "Centerinside"
/>
Com.jxj.view is the package name Bigdialview is its own defined class name Com.jxj.view.BigDialView is the full path
The problem with easy error here is that the class is not found in XML, usually because the class is undefined, or if the package name or class name is wrong, the XML cannot be found
(3) This is seen in the loonandroid framework. Think it's nice.
All of the basic controls will use these two statements
Android:layout_width= "Fill_parent"
android:layout_height= "Wrap_content"
In the loonandroid framework, it is simpler to use this method and replace it with a single statement.
<relativelayout
Android:id= "@+id/top_head"
style= "@style/w_full_h_wrap"
android:background= "@drawable/head_back"
android:orientation= "Horizontal" >
Equivalent to
<relativelayout
Android:id= "@+id/top_head"
Android:layout_width= "Fill_parent"
android:layout_height= "Wrap_content"
android:background= "@drawable/head_back"
android:orientation= "Horizontal" >
Want to use such a method. Just add it in the Values folder
Themes_basic.xml
<?xml version= "1.0" encoding= "Utf-8"?>
<resources xmlns:android= "Http://schemas.android.com/apk/res/android" >
<!--full Screen stretch--
<style name= "W_h_full" >
<item name= "Android:layout_width" >fill_parent</item>
<item name= "Android:layout_height" >fill_parent</item>
</style>
<!--height as wide as screen height adaptive--
<style name= "W_wrap_h_full" >
<item name= "Android:layout_width" >wrap_content</item>
<item name= "Android:layout_height" >fill_parent</item>
</style>
<!--width is as highly adaptive as screen width-
<style name= "W_full_h_wrap" >
<item name= "Android:layout_width" >fill_parent</item>
<item name= "Android:layout_height" >wrap_content</item>
</style>
<!--fix itself size--
<style name= "W_wrap_h_wrap" >
<item name= "Android:layout_width" >wrap_content</item>
<item name= "Android:layout_height" >wrap_content</item>
</style>
</resources>
Summary of XML layout content (iv)--android