Android mobile guard-implements an entry layout structure on the settings interface. android entries

Source: Internet
Author: User

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:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.