0
內的RelativeLayout使用這是我的Android問題與layout_height在Android 1.5的
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<SurfaceView android:id="@+id/surface_camera"
android:layout_width="fill_parent" android:layout_height="420px">
</SurfaceView>
<RelativeLayout android:layout_width="fill_parent"
android:layout_alignParentBottom="true" android:id="@+id/beforeClick"
android:layout_height="wrap_content" android:background="@color/clickPanelBK"
android:paddingTop="6dp" android:paddingBottom="6dp">
<Button android:gravity="center" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="@+id/capture_image_goback_btn"
android:background="@drawable/generalbutton" android:text="@string/back" />
<Button android:gravity="center"
android:layout_centerHorizontal="true" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="@+id/capture_image_btn"
android:background="@drawable/clickbutton" />
</RelativeLayout>
<RelativeLayout android:layout_width="fill_parent"
android:layout_alignParentBottom="true" android:id="@+id/afterClick"
android:layout_height="wrap_content" android:background="@color/clickPanelBK"
android:paddingTop="6dp" android:paddingBottom="6dp">
<Button android:gravity="center" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="@+id/img_retake"
android:background="@drawable/generalbutton" android:text="@string/retake" />
<Button android:gravity="center"
android:layout_alignParentRight="true" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="@+id/img_save"
android:text="@string/saveImg" android:background="@drawable/generalbutton" />
</RelativeLayout>
</RelativeLayout>
佈局的圖像捕獲程序的最後2個相對佈局交換和對齊罰款。一次只顯示其中一個,並通過單擊按鈕進行更改。無論如何,這裏的問題是,我不得不提到px或dp中的表面視圖的layout_height。如果我將layout_height設置爲fill_parent,視圖顯示非常小,寬度和高度的35%。任何人都可以請給我一個解決方案?
看到這裏使用FILL_PARENT的layout_height以'SurfaceView'的示例項目:http://github.com/commonsguy/cw-advandroid/tree/master /攝像頭/預覽/ – CommonsWare 2010-08-01 06:59:29