Android 手機衛士--實現設定介面的一個條目布局結構,android條目

來源:互聯網
上載者:User

Android 手機衛士--實現設定介面的一個條目布局結構,android條目

本文地址:http://www.cnblogs.com/wuyudong/p/5908986.html,轉載請註明源地址。

本文以及後續文章,將一步步完善功能列表:

要點擊九宮格中的條目,需要註冊點擊事件

        // 註冊九宮格單個條目的點擊事件        gv_home.setOnItemClickListener(new OnItemClickListener() {            // 點中列表條目索引 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;                }            }        });

毫無疑問需要建立SettingActivity.java

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);    }}

在點擊相應的條目後,跳轉到“設定中心”,於是建立activity_setting.xml布局檔案

<?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="自動更新設定"            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="自動更新已關閉"            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>

本文先實現設定中心選項的一個條目布局結構,如下紅色方框所示:

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.