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

问题描述:

我创建如下的布局,偏好活动布局没有出现在android中?

<?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其是在谷歌源中可用的自定义类

,它是偏好活动类。

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

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

谢谢

尝试并使用FrameLoyout或RelativeLayout。确保您在绘制LevelView之前绘制CancorderView,否则LevelView会得到CamcorderView(这是因为android处理z-index的方式)

如果您的活动扩展了PreferenceActivity并且您想从xml文件加载布局,你的根元素必须是PreferenceScreen。在PreferenceScreen中,您可以使用像CheckBoxPreference,EditTextPreferenceListPreference等元素。Here is an example and documentation

就你而言,最好是扩展Activity并使用你的布局。然后你可以使用SharedPreferences来存储你想要的设置。