我真的很难找出这里发生了什么。我有这个XML文件描述了一个布局:XML布局不能正确显示
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<SurfaceView android:id="@+id/surface"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center">
</SurfaceView>
<TextView android:id="@+id/text_kb_streamed"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textStyle="bold"
android:text="Streaming .mp3 Audio Tutorial" />
<ProgressBar android:id="@+id/progress_bar"
android:layout_width="200px"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
style="?android:attr/progressBarStyleHorizontal"/>
<ImageButton android:id="@+id/button_play"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5px"
style="?android:attr/buttonStyleSmall"
android:src="@drawable/button_pause" />
</LinearLayout>
但是,当涉及到绘制,它只是显示一个空的黑色屏幕。我在我的活动中调用setContentView。事实上,我发现如果我删除SurfaceView标签,它会被正确绘制。
任何人都可以帮助我知道发生了什么? 谢谢
编辑:由于答案,我已经发现SurfaceView正在采取所有的空间,所以按钮不可见。关于如何避免这种情况的任何想法? 谢谢
我从来没有使用过SurfaceView,它有任何环绕的内在维度?看起来它占据了所有的空间。我会尝试给它一些像20px一样的小高点。 – bigstones 2011-01-24 17:08:52