我有您在图片中看到的布局(抱歉,我还不能正常发布它们): https://dl.dropboxusercontent.com/u/28640502/Unbenannt.bmp
但是,当我执行该应用程序时,我只能看到相机预览,而看不到文本和 SeekBar。我知道它们有效,因为当我减小相机的尺寸时,我可以看到它们并进行交互,但如果我希望相机像背景一样,然后 children 在它上面,它就不起作用。
我已经检查了很多有类似问题的线程,但我没有找到解决方案: 1 , 2 , 3 ... 任何想法?非常感谢!
以下是我的 xml 代码以防万一:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.55"
android:orientation="vertical" >
<FrameLayout
android:id="@+id/camera_preview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="fill">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="@+id/show_height"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5sp"
android:layout_marginRight="10sp"
android:layout_weight="0.12"
android:text="H" />
<SeekBar
android:id="@+id/select_height"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_margin="5sp"
android:layout_weight="0.91" />
<TextView
android:id="@+id/show_distance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.06"
android:text="Dist" />
</LinearLayout>
</FrameLayout>
</LinearLayout>
最佳答案
例如尝试在相对布局中输入您的两个布局
<LL>
<RL>
<FL>
</FL>
<LL>
</LL>
</RL>
</LL>
这是因为 LL 被 FL 覆盖而发生的
关于安卓布局 : cannot see the children over the parent,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18866392/