2011-06-09 65 views
1

我創建如下的佈局,偏好活動佈局沒有出現在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作爲攝像機視圖中的疊加視圖,需要做什麼?

如果有人知道解決方案幫助我。

謝謝

回答

0

嘗試並使用FrameLoyout或RelativeLayout。確保您在繪製LevelView之前繪製CancorderView,否則LevelView會得到CamcorderView(這是因爲android處理z-index的方式)

0

如果您的活動擴展了PreferenceActivity並且您想從xml文件加載佈局,你的根元素必須是PreferenceScreen。在PreferenceScreen中,您可以使用像CheckBoxPreference,EditTextPreferenceListPreference等元素。Here is an example and documentation

就你而言,最好是擴展Activity並使用你的佈局。然後你可以使用SharedPreferences來存儲你想要的設置。