Android记事本NotePad应用功能拓展(四)

一、实现功能

1.绘制设置界面

Android记事本NotePad应用功能拓展(四)_第1张图片

二、项目代码分析

1.点击待办事件添加计划Plan

设置界面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"    xmlns:app="http://schemas.android.com/apk/res-auto"    android:orientation="vertical"    android:background="?attr/lvBackground">    <android.support.v7.widget.Toolbar        android:id="@+id/my_toolbar"        android:layout_width="match_parent"        android:layout_height="?attr/actionBarSize"        android:background="?attr/colorPrimary"        android:elevation="4dp"        app:titleTextColor="?attr/titleColor"        app:title="设置"        android:theme="@style/ThemeOverlay.AppCompat.ActionBar"        app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>    <LinearLayout        android:layout_width="match_parent"        android:layout_height="wrap_content"        android:layout_margin="20dp"        android:orientation="horizontal">        <LinearLayout            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:layout_weight="1"            android:orientation="vertical">            <TextView                android:layout_width="wrap_content"                android:layout_height="wrap_content"                android:text="夜间模式"                android:textColor="?attr/tvMainColor"                android:textSize="20dp" />            <TextView                android:layout_width="wrap_content"                android:layout_height="wrap_content"                android:text="@string/pref_night_summary"                android:textColor="?attr/tvSubColor"                android:textSize="16dp" />        </LinearLayout>        <Switch            android:id="@+id/nightMode"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:layout_marginLeft="10dp"            android:layout_marginTop="10dp"            android:clickable="true"            android:gravity="center"            android:switchMinWidth="50dp"             />    </LinearLayout>    <View        android:layout_width="match_parent"        android:layout_height="1dp"        android:layout_marginLeft="10dp"        android:layout_marginRight="10dp"        android:foreground="@color/greyC"        />    <LinearLayout        android:layout_width="match_parent"        android:layout_height="wrap_content"        android:layout_margin="20dp"        android:orientation="horizontal">        <LinearLayout            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:layout_weight="1"            android:orientation="vertical">            <TextView                android:layout_width="wrap_content"                android:layout_height="wrap_content"                android:text="@string/pref_reversesort"                android:textColor="?attr/tvMainColor"                android:textSize="20dp" />            <TextView                android:layout_width="wrap_content"                android:layout_height="wrap_content"                android:text="@string/pref_reversesort_summary"                android:textColor="?attr/tvSubColor"                android:textSize="16dp" />        </LinearLayout>        <Switch            android:id="@+id/reverseSort"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:layout_marginLeft="10dp"            android:layout_marginTop="10dp"            android:checked="false"            android:gravity="center"            android:switchMinWidth="50dp"            android:textOff="关闭"            android:textOn="打开" />    </LinearLayout>    <View        android:layout_width="match_parent"        android:layout_height="1dp"        android:layout_marginLeft="10dp"        android:layout_marginRight="10dp"        android:foreground="@color/greyC"        />    <LinearLayout        android:layout_width="match_parent"        android:layout_height="wrap_content"        android:layout_margin="20dp"        android:orientation="horizontal">        <LinearLayout            android:id="@+id/fabColor"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:layout_weight="1"            android:orientation="horizontal">            <LinearLayout                android:layout_width="wrap_content"                android:layout_height="wrap_content"                android:orientation="vertical"                android:layout_weight="1"                >                <TextView                    android:layout_width="wrap_content"                    android:layout_height="wrap_content"                    android:text="@string/pref_fabcolor"                    android:textColor="?attr/tvMainColor"                    android:textSize="20dp" />                <TextView                    android:layout_width="wrap_content"                    android:layout_height="wrap_content"                    android:text="@string/pref_fabcolor_summary"                    android:textColor="?attr/tvSubColor"                    android:textSize="16dp" />            </LinearLayout>            <ImageView                android:layout_width="wrap_content"                android:layout_height="wrap_content"                android:layout_gravity="center_vertical"                android:layout_marginEnd="15dp"                android:layout_marginStart="15dp"                android:src="?attr/addTag"                />        </LinearLayout>    </LinearLayout>    <View        android:layout_width="match_parent"        android:layout_height="1dp"        android:layout_marginLeft="10dp"        android:layout_marginRight="10dp"        android:foreground="@color/greyC"        />    <LinearLayout        android:layout_width="match_parent"        android:layout_height="wrap_content"        android:layout_margin="20dp"        android:orientation="horizontal">        <LinearLayout            android:id="@+id/fabPlanColor"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:layout_weight="1"            android:orientation="vertical">            <TextView                android:layout_width="wrap_content"                android:layout_height="wrap_content"                android:text="@string/pref_fabplancolor"                android:textColor="?attr/tvMainColor"                android:textSize="20dp" />            <TextView                android:layout_width="wrap_content"                android:layout_height="wrap_content"                android:text="@string/pref_fabplancolor_summary"                android:textColor="?attr/tvSubColor"                android:textSize="16dp" />        </LinearLayout>        <ImageView            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:src="?attr/addPlanTag"            android:layout_marginStart="15dp"            android:layout_marginEnd="15dp"            android:layout_gravity="center_vertical"/>    </LinearLayout>    <View        android:layout_width="match_parent"        android:layout_height="1dp"        android:layout_marginLeft="10dp"        android:layout_marginRight="10dp"        android:foreground="@color/greyC"        />    <LinearLayout        android:layout_width="match_parent"        android:layout_height="wrap_content"        android:layout_margin="20dp"        android:orientation="horizontal">        <LinearLayout            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:layout_weight="1"            android:orientation="vertical">            <TextView                android:layout_width="wrap_content"                android:layout_height="wrap_content"                android:text="@string/pref_notetitle"                android:textColor="?attr/tvMainColor"                android:textSize="20dp" />            <TextView                android:layout_width="wrap_content"                android:layout_height="wrap_content"                android:text="@string/pref_notetitle_summary"                android:textColor="?attr/tvSubColor"                android:textSize="16dp" />        </LinearLayout>        <Switch            android:id="@+id/noteTitle"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:layout_marginLeft="10dp"            android:layout_marginTop="10dp"            android:clickable="true"            android:gravity="center"            android:switchMinWidth="50dp"            />    </LinearLayout>    <View        android:layout_width="match_parent"        android:layout_height="1dp"        android:layout_marginLeft="10dp"        android:layout_marginRight="10dp"        android:foreground="@color/greyC"        /></LinearLayout>

三、参考资料

相关参考:Android记事本NotePad应用功能拓展(一)
作者GitHub下载链接:https://github.com/KangKangBigWorld/Android/tree/master/Mid_Test

更多相关文章

  1. Android控件笔记——在界面中显示及输入文本信息
  2. Android异步处理系列文章四篇之一使用Thread+Handler实现非UI线
  3. Android 界面布局之RelativeLayout
  4. 使用AsyncTask异步更新UI界面
  5. android开发,修改默认界面的背景色
  6. Android常用UI界面设计及国际化
  7. 让star也具有CheckBox 功能
  8. 关于Android软键盘弹出,会把原来的界面挤上去的问题
  9. android 界面中加入密码框

随机推荐

  1. 把简单的老Android(安卓)App项目转移到An
  2. android Handle
  3. android 钓鱼程序
  4. 【工利其器】必会工具之(四)Refactor篇——
  5. Android AlertDialog的一切
  6. 作为一个iOS开发者,想知道作为一个Android
  7. Android热补丁技术—dexposed原理简析(阿
  8. 我的Android进阶之旅------>Android中解
  9. Android.mk语法说明(android ndk开发)
  10. 【移动开发】Android无线调试 使用adbWir