[mobilesafe] 07_程序锁界面布局文件xml

Android 4.0

程序锁界面

1、对于本身不可点击的TextView:如果要在xml布局文件中配置点击事件,那要加上下面两句到布局文件
android:clickable="true"
android:focusable="true"  
<TextView
    android:id="@+id/tv_app_unlocked"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@drawable/tab_right_default"
    android:clickable="true"
    android:focusable="true"
    android:gravity="center"
    android:onClick="click"
    android:text="未加锁"
    android:textColor="#ffffff"
    android:textSize="20sp" />
但如果只是在代码中注册点击事件,那么不需要在xml布局文件中加上这两句代码
2、为什么要用帧布局呢?FrameLayout
因为FrameLayout可以让两面的内容一层一层的显示
程序锁布局文件:
<?xml version="1.0" encoding="utf-8"?>
<!-- 29、程序锁功能的布局文件 -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <!-- 1、已加锁和未加锁标题 -->
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#880000ff"
        android:gravity="center"
        android:orientation="horizontal" >
        <TextView
            android:id="@+id/tv_app_unlocked"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/tab_left_pressed"
            android:gravity="center"
            android:onClick="click"
            android:text="@string/app_unlocked"
            android:textColor="#ffffff"
            android:textSize="20sp" />
        <TextView
            android:id="@+id/tv_app_locked"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/tab_right_default"
            android:gravity="center"
            android:text="@string/app_locked"
            android:textColor="#ffffff"
            android:textSize="20sp" />
    </LinearLayout>

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >

        <!-- 2、展示未加锁应用 -->
        <LinearLayout
            android:id="@+id/ll_lv_unlocked"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical" >
            <TextView
                android:id="@+id/tv_listview_app_unlocked"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@android:color/darker_gray"
                android:textSize="18sp" />
            <ListView
                android:id="@+id/lv_app_unlocked"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" >
            </ListView>
        </LinearLayout>

        <!-- 3、展示已加锁应用 -->
        <LinearLayout
            android:id="@+id/ll_lv_locked"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@android:color/darker_gray"
            android:orientation="vertical"
            android:visibility="invisible" >
            <TextView
                android:id="@+id/tv_listview_app_locked"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:textSize="18sp" />
            <ListView
                android:id="@+id/lv_app_locked"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" >
            </ListView>
        </LinearLayout>

        <!-- 4、获取数据的等待界面 -->
        <LinearLayout
            android:id="@+id/ll_loading_data"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="center"
            android:orientation="vertical"
            android:visibility="invisible" >
            <ProgressBar
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="10dip"
                android:text="@string/loadind_data_waiting" />
        </LinearLayout>
    </FrameLayout>
    
</LinearLayout>
效果:

问题1:有的应用的名字过长