Android mobile guard-implements an entry layout structure on the settings interface. android entries
URL: http://www.cnblogs.com/wuyudong/p/5908986.html.
This article and subsequent articles will improve the function list step by step:
To click an entry in the jiugongge, You need to register a click event.
// Register the Click Event gv_home.setOnItemClickListener (new OnItemClickListener () {// index position @ Override public void onItemClick (AdapterView <?> Parent, View view, int position, long id) {switch (position) {case 0: break; case 8: Intent intent = new Intent (getApplicationContext (), SettingActivity. class); startActivity (intent); break; default: break ;}}});
There is no doubt that SettingActivity. java needs to be created.
package com.wuyudong.mobilesafe.activity;import com.wuyudong.mobilesafe.R;import android.app.Activity;import android.os.Bundle;public class SettingActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.activity_setting); }}
After clicking the corresponding entry, the page jumps to "setting center", and the activity_setting.xml layout file is created.
<? Xml version = "1.0" encoding = "UTF-8"?> <LinearLayout xmlns: android = "http://schemas.android.com/apk/res/android" android: layout_width = "match_parent" android: layout_height = "match_parent" android: orientation = "vertical"> <RelativeLayout android: layout_width = "match_parent" android: layout_height = "wrap_content" android: padding = "5dp"> <TextView android: id = "@ + id/TV _title" android: layout_width = "wrap_content" android: layout_height = "wrap_content" android: text = "auto update settings" android: textColor = "#000" android: textSize = "18sp"/> <TextView android: id = "@ + id/TV _des" android: layout_width = "wrap_content" android: layout_height = "wrap_content" android: layout_below = "@ id/TV _title" android: text = "auto update disabled" android: textColor = "#000" android: textSize = "18sp"/> <CheckBox android: id = "@ + id/cb_box" android: layout_alignParentRight = "true" android: layout_centerVertical = "true" android: layout_width = "wrap_content" android: layout_height = "wrap_content"/> <View android: layout_below = "@ id/TV _des" android: background = "#000" android: layout_width = "match_parent" android: layout_height = "1dp"/> </RelativeLayout> </LinearLayout>
This article first sets an entry layout structure for the central option, as shown in the red box below: