This article address: http://www.cnblogs.com/wuyudong/p/5908986.html, reprint please indicate source address.
This article, along with subsequent articles, will refine the list of features in one step:
To click on an entry in nine, you need to register a click event
//Register for nine Gongge single entry click eventsGv_home.setonitemclicklistener (NewOnitemclicklistener () {//point in the list entry index position@Override Public voidOnitemclick (adapterview<?>Parent, view view,intPositionLongID) {Switch(position) { Case0: Break; Case8: Intent Intent=NewIntent (Getapplicationcontext (), settingactivity.class); StartActivity (Intent); Break; default: Break; } } });
No doubt a new Settingactivity.java is needed
Packagecom.wuyudong.mobilesafe.activity;ImportCOM.WUYUDONG.MOBILESAFE.R;Importandroid.app.Activity;ImportAndroid.os.Bundle; Public classSettingactivityextendsActivity {@Overrideprotected voidonCreate (Bundle savedinstancestate) {//TODO auto-generated Method Stub Super. OnCreate (savedinstancestate); Setcontentview (r.layout.activity_setting); }}
After clicking on the appropriate entry, jump to "settings center" and create a new Activity_setting.xml layout file
<?XML version= "1.0" encoding= "Utf-8"?><LinearLayoutxmlns:android= "Http://schemas.android.com/apk/res/android"Android:layout_width= "Match_parent"Android:layout_height= "Match_parent"android:orientation= "vertical" > <RelativelayoutAndroid:layout_width= "Match_parent"Android:layout_height= "Wrap_content"android:padding= "5DP" > <TextViewAndroid:id= "@+id/tv_title"Android:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"Android:text= "Automatic Update settings"Android:textcolor= "#000"android:textsize= "18SP" /> <TextViewAndroid:id= "@+id/tv_des"Android:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"Android:layout_below= "@id/tv_title"Android:text= "Automatic Update is OFF"Android:textcolor= "#000"android:textsize= "18SP" /> <CheckBoxAndroid:id= "@+id/cb_box"Android:layout_alignparentright= "true"android:layout_centervertical= "true"Android:layout_width= "Wrap_content"Android:layout_height= "Wrap_content" /> <ViewAndroid:layout_below= "@id/tv_des"Android:background= "#000"Android:layout_width= "Match_parent"Android:layout_height= "1DP" /> </Relativelayout></LinearLayout>
This article first implements an entry layout structure for the Set center option, as shown in the red box below:
Android phone defender--implements an entry layout structure for the Setup interface