Java Android,SurfaceView可扩展整个宽度&;所需的屏幕高度,无法将TextView放置在surfaceView上

Java Android,SurfaceView可扩展整个宽度&;所需的屏幕高度,无法将TextView放置在surfaceView上,java,android,android-layout,android-gui,Java,Android,Android Layout,Android Gui,我希望我的布局显示覆盖所有屏幕宽度的surfaceView,并在surfaceView顶部显示TextView,在surfaceView下方显示另一个水平布局 下面是我的Eclipse android GUI设计器的快照: 下面是我的Galaxy S3设备上实际GUI的快照: 下面是此GUI/活动的更新布局xml <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="h

我希望我的布局显示覆盖所有屏幕宽度的surfaceView,并在surfaceView顶部显示TextView,在surfaceView下方显示另一个水平布局

下面是我的Eclipse android GUI设计器的快照:

下面是我的Galaxy S3设备上实际GUI的快照:

下面是此GUI/活动的更新布局xml

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


    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
           android:id="@+id/RelativeLayoutForPreview"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >

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

    <!-- SurfaceView should cover all the screens width  -->
    <SurfaceView
        android:id="@+id/surfaceViewBarcodeScanner"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

    <!-- TextView should be above SurfaceView  -->

    <!-- LinearLayout will contain linear toolbar   -->

    <TextView
        android:id="@+id/mytext"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/mbackground2"
        android:gravity="center_horizontal"
        android:padding="20dip"
        android:textColor="@color/mytextcolor" />

</FrameLayout>

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="62dp"
    android:layout_alignParentBottom="true"
    android:layout_alignParentLeft="true"
    android:background="@drawable/scanner_bottom" >
</LinearLayout>

  </RelativeLayout>


谢谢

我希望这就是你想要的。不过,我不确定我是否理解正确

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <!-- SurfaceView should cover all the screens width  -->
    <SurfaceView
        android:id="@+id/surfaceViewBarcodeScanner"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

    <!-- TextView should be above SurfaceView  -->
    <TextView
        android:id="@+id/mytext"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/mbackground2"
        android:gravity="center_horizontal"
        android:padding="20dip"
        android:textColor="@color/mytextcolor"/>

    <!-- LinearLayout will contain linear toolbar   -->
    <LinearLayout
        android:id="@+id/ScannerBottomToolbar"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:layout_marginBottom="48dp"
        android:layout_marginLeft="77dp"
        android:orientation="vertical">

    </LinearLayout>
</FrameLayout>

@Yuichi Araki,谢谢,surfaceView扩展得很好,但是我仍然没有看到顶部的黄色背景文本视图和底部的工具栏图像,尽管设计器显示Eclipse GUI设计器在正确的位置显示了所有内容。我更新了上面的xml/快照以反映新的更改。