Android布局——小米便签编辑界面xml

最近在学习小米便签的开源项目,现在对note编辑界面对应的note_edit.xml做一些注释笔记。
项目地址:https://github.com/MiCode/Notes

界面效果如图:
note编辑界面效果

<?xml version="1.0" encoding="utf-8"?>

<!-- Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net)

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->

<FrameLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/list_background"
    xmlns:android="http://schemas.android.com/apk/res/android">

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical">
<!--顶栏代码:当前时间(TextView),闹钟icon(ImageView),提醒时间(TextView),颜色选择按钮(ImageButton)
-->
        <LinearLayout
            android:id="@+id/note_title"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content">

            <TextView
                android:id="@+id/tv_modified_date"
                android:layout_width="0dip"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:layout_gravity="left|center_vertical"
                android:layout_marginRight="8dip"
                android:textAppearance="@style/TextAppearanceSecondaryItem" />

            <ImageView
                android:id="@+id/iv_alert_icon"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_vertical"
                android:background="@drawable/title_alert" />

            <TextView
                android:id="@+id/tv_alert_date"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_vertical"
                android:layout_marginLeft="2dip"
                android:layout_marginRight="8dip"
                android:textAppearance="@style/TextAppearanceSecondaryItem" />

            <ImageButton
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:background="@drawable/bg_btn_set_color" />
        </LinearLayout>
<!--正文部分:背景颜色选择(ImageView),垂直滚动条(ScrollView),字体大小设置(FrameLayout)
-->
        <LinearLayout
            android:id="@+id/sv_note_edit"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:orientation="vertical">

            <ImageView
                android:layout_width="fill_parent"
                android:layout_height="7dip"
                android:background="@drawable/bg_color_btn_mask" />

            <ScrollView
                android:layout_width="fill_parent"
                android:layout_height="0dip"
                android:layout_weight="1"
                android:scrollbars="none"
                android:overScrollMode="never"
                android:layout_gravity="left|top"
                android:fadingEdgeLength="0dip">

                <LinearLayout
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent">

                    <net.micode.notes.ui.NoteEditText
                        android:id="@+id/note_edit_view"
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:gravity="left|top"
                        android:background="@null"
                        android:autoLink="all"
                        android:linksClickable="false"
                        android:minLines="12"
                        android:textAppearance="@style/TextAppearancePrimaryItem"
                        android:lineSpacingMultiplier="1.2" />

                    <LinearLayout
                        android:id="@+id/note_edit_list"
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:orientation="vertical"
                        android:layout_marginLeft="-10dip"
                        android:visibility="gone" />
                </LinearLayout>
            </ScrollView>

            <ImageView
                android:layout_width="fill_parent"
                android:layout_height="7dip"
                android:background="@drawable/bg_color_btn_mask" />
        </LinearLayout>
    </LinearLayout>

    <ImageView
        android:id="@+id/btn_set_bg_color"
        android:layout_height="43dip"
        android:layout_width="wrap_content"
        android:background="@drawable/bg_color_btn_mask"
        android:layout_gravity="top|right" />

    <LinearLayout
        android:id="@+id/note_bg_color_selector"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@drawable/note_edit_color_selector_panel"
        android:layout_marginTop="30dip"
        android:layout_marginRight="8dip"
        android:layout_gravity="top|right"

<!--选择背景色为黄色-->
        <FrameLayout
            android:layout_width="0dip"
            android:layout_height="match_parent"
            android:layout_weight="1">

            <ImageView
                android:id="@+id/iv_bg_yellow"
                android:layout_width="match_parent"
                android:layout_height="match_parent" />

            <ImageView
                android:id="@+id/iv_bg_yellow_select"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="bottom|right"
                android:layout_marginRight="5dip"
                android:focusable="false"
                android:visibility="gone"
                android:src="@drawable/selected" />
        </FrameLayout>

<!--选择背景色为蓝色-->
        <FrameLayout
            android:layout_width="0dip"
            android:layout_height="match_parent"
            android:layout_weight="1">

            <ImageView
                android:id="@+id/iv_bg_blue"
                android:layout_width="match_parent"
                android:layout_height="match_parent" />

            <ImageView
                android:id="@+id/iv_bg_blue_select"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="bottom|right"
                android:focusable="false"
                android:visibility="gone"
                android:layout_marginRight="3dip"
                android:src="@drawable/selected" />

<!--选择背景色为白色-->
        <FrameLayout
            android:layout_width="0dip"
            android:layout_height="match_parent"
            android:layout_weight="1">

            <ImageView
                android:id="@+id/iv_bg_white"
                android:layout_width="match_parent"
                android:layout_height="match_parent" />

            <ImageView
                android:id="@+id/iv_bg_white_select"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="bottom|right"
                android:focusable="false"
                android:visibility="gone"
                android:layout_marginRight="2dip"
                android:src="@drawable/selected" />
        </FrameLayout>

<!--选择背景色为绿色-->
        <FrameLayout
            android:layout_width="0dip"
            android:layout_height="match_parent"
            android:layout_weight="1">

            <ImageView
                android:id="@+id/iv_bg_green"
                android:layout_width="match_parent"
                android:layout_height="match_parent" />

            <ImageView
                android:id="@+id/iv_bg_green_select"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="bottom|right"
                android:focusable="false"
                android:visibility="gone"
                android:src="@drawable/selected" />

<!--选择背景色为红色-->
        <FrameLayout
            android:layout_width="0dip"
            android:layout_height="match_parent"
            android:layout_weight="1">

            <ImageView
                android:id="@+id/iv_bg_red"
                android:layout_width="match_parent"
                android:layout_height="match_parent" />

            <ImageView
                android:id="@+id/iv_bg_red_select"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="bottom|right"
                android:focusable="false"
                android:visibility="gone"
                android:src="@drawable/selected" />
        </FrameLayout>
    </LinearLayout>

<!--字体大小设置-->
    <LinearLayout
        android:id="@+id/font_size_selector"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/font_size_selector_bg"
        android:layout_gravity="bottom"

<!--选择小字号-->
        <FrameLayout
            android:id="@+id/ll_font_small"
            android:layout_width="0dip"
            android:layout_height="wrap_content"
            android:layout_weight="1">

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:layout_gravity="center"
                android:gravity="center">

                <ImageView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:src="@drawable/font_small"
                    android:layout_marginBottom="5dip" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@string/menu_font_small"
                    android:textAppearance="@style/TextAppearanceUnderMenuIcon" />
            </LinearLayout>

            <ImageView
                android:id="@+id/iv_small_select"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="bottom|right"
                android:layout_marginRight="6dip"
                android:layout_marginBottom="-7dip"
                android:focusable="false"
                android:visibility="gone"
                android:src="@drawable/selected" />
        </FrameLayout>

<!--选择正常字号-->
        <FrameLayout
            android:id="@+id/ll_font_normal"
            android:layout_width="0dip"
            android:layout_height="wrap_content"
            android:layout_weight="1">

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:layout_gravity="center"
                android:gravity="center">

                <ImageView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:src="@drawable/font_normal"
                    android:layout_marginBottom="5dip" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@string/menu_font_normal"
                    android:textAppearance="@style/TextAppearanceUnderMenuIcon" />
            </LinearLayout>

            <ImageView
                android:id="@+id/iv_medium_select"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="bottom|right"
                android:focusable="false"
                android:visibility="gone"
                android:layout_marginRight="6dip"
                android:layout_marginBottom="-7dip"
                android:src="@drawable/selected" />

<!--选择大字号-->
        <FrameLayout
            android:id="@+id/ll_font_large"
            android:layout_width="0dip"
            android:layout_height="wrap_content"
            android:layout_weight="1">

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:layout_gravity="center"
                android:gravity="center">

                <ImageView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:src="@drawable/font_large"
                    android:layout_marginBottom="5dip" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@string/menu_font_large"
                    android:textAppearance="@style/TextAppearanceUnderMenuIcon" />
            </LinearLayout>

            <ImageView
                android:id="@+id/iv_large_select"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="bottom|right"
                android:focusable="false"
                android:visibility="gone"
                android:layout_marginRight="6dip"
                android:layout_marginBottom="-7dip"
                android:src="@drawable/selected" />
        </FrameLayout>

<!--选择超大字号-->
        <FrameLayout
            android:id="@+id/ll_font_super"
            android:layout_width="0dip"
            android:layout_height="wrap_content"
            android:layout_weight="1">

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:layout_gravity="center"
                android:gravity="center">

                <ImageView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:src="@drawable/font_super"
                    android:layout_marginBottom="5dip" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@string/menu_font_super"
                    android:textAppearance="@style/TextAppearanceUnderMenuIcon" />
            </LinearLayout>

            <ImageView
                android:id="@+id/iv_super_select"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="bottom|right"
                android:focusable="false"
                android:visibility="gone"
                android:layout_marginRight="6dip"
                android:layout_marginBottom="-7dip"
                android:src="@drawable/selected" />
        </FrameLayout>
    </LinearLayout>
</FrameLayout>

    说明:希望通过blog来记录我的学习历程,同时想借助此平台分享遇到的各种问题以及解决方案,期待能够与大家共同进步,Nothing is waived.
  • 0
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
要在Android Studio小米便签添加密码功能,需要进行以下步骤: 首先,在小米便签布局文件添加一个密码输入框和一个确认密码输入框,和一个按钮供用户设置密码。可以使用 EditText 组件来实现密码输入框,使用 Button 组件作为按钮。 然后,在相关的活动(Activity),找到对应的密码输入框和确认密码输入框,获取用户输入的密码和确认密码。 接下来,编写代码来验证用户输入的密码和确认密码是否匹配,如果匹配,则将密码保存到 SharedPreferences 。SharedPreferences 是 Android 提供的轻量级的数据存储方法,可以用来存储简单的键值对数据。 在适当的时机,比如用户登录或进入小米便签时,需要验证用户输入的密码是否匹配保存的密码。可以通过比较用户输入的密码和从 SharedPreferences 取出的密码来实现。 如果验证匹配成功,则用户可以进入小米便签的功能页面。否则,可以提示用户密码输入错误,并重新输入密码。 此外,为了确保数据的隐私和安全性,可以考虑对密码进行加密处理。Android Studio 提供了一些加密库,比如 AES 加密算法,可以帮助实现加密功能。 最后,需要注意保护好保存密码的 SharedPreferences 文件,避免被未授权的访问。可以通过设置文件权限或者使用加密算法保护数据存储的安全性。 综上所述,以上是在Android Studio小米便签添加密码功能的大致步骤和一些相关注意事项。具体实现的细节和代码可以根据具体需求和环境进行调整。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值