Android中没有出现偏好活动布局?

时间:2011-06-09 05:38:04

标签: android android-layout

我创建了以下布局,

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

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:id="@+id/levelcam" android:orientation="vertical">

<com.tes.VisGo.CamcorderView
    android:focusable="true" android:clickable="true" android:id="@+id/camcorder_preview"
    android:layout_height="fill_parent" android:layout_width="wrap_content"
    android:layout_marginLeft="0dp"></com.tes.VisGo.CamcorderView>
<ImageView android:id="@+id/red" android:layout_width="25dp"
    android:layout_height="25dp" android:layout_x="30dp" android:layout_y="230dp"
    android:layout_alignParentRight="true" android:layout_marginTop="-30dp"
    android:layout_marginLeft="20dp">

</ImageView>

<TextView android:id="@+id/timer" android:text=""
    android:layout_marginTop="-23dp" android:layout_height="20dp"
    android:layout_width="60dp" android:layout_marginLeft="35dp">
</TextView>
<TextView android:id="@+id/camera_categories"
    android:textColor="#FF0033" android:layout_height="wrap_content"
    android:layout_width="wrap_content" android:textSize="17dp"
    android:textStyle="bold" android:layout_gravity="center_horizontal"
    android:text="xcv" android:layout_marginLeft="-20dp"
    android:layout_marginTop="-25dp"></TextView>
<ImageView android:id="@+id/rcount"
    android:layout_marginLeft="220dp" android:layout_height="120dp"
    android:layout_width="120dp" android:layout_marginTop="-200dp">
</ImageView>
<Button android:id="@+id/widget34" android:background="@drawable/camrecord"
    android:layout_height="60dp" android:layout_width="60dp"
    android:layout_gravity="right" android:layout_marginRight="5dp">
</Button>
<Button android:id="@+id/widget33" android:background="@drawable/stoprecord"
    android:layout_gravity="right" android:layout_height="60dp"
    android:layout_width="60dp" android:layout_marginRight="5dp"
    android:layout_marginTop="-60dp">
</Button>
<net.androgames.level.view.LevelView
    android:id="@+id/level" android:layout_height="50dp"
    android:layout_gravity="center" android:layout_marginLeft="10dp"
    android:layout_width="160dp" android:keepScreenOn="true"></net.androgames.level.view.LevelView>

在这个布局中摄像机视图是表面视图,并且使用媒体记录器进行录制,另一个LevelView是谷歌源中可用的自定义类,它是Preference活动类。

当使用LevelView作为与摄像机视图的叠加时它不会出现,但是当我使用摄像机底部的LevelView时,它会出现。     但我需要LevelView作为摄像机中的叠加视图,必须做什么?

如果有人知道解决方案可以帮助我。

由于

2 个答案:

答案 0 :(得分:0)

尝试使用FrameLoyout或RelativeLayout。确保你在绘制LevelView之前画'CancorderView',否则LevelView会落后于CamcorderView(这是因为android处理z-index的方式)

答案 1 :(得分:0)

如果您的活动延伸PreferenceActivity并且您想要从xml文件加载布局,则您的根元素必须为PreferenceScreen。在PreferenceScreen中,您可以使用CheckBoxPreferenceEditTextPreferenceListPreference等元素Here is an example and documentation

在您的情况下,最好扩展Activity并使用您的布局。然后,您可以使用SharedPreferences存储所需的设置。