安卓布局 : cannot see the children over the parent

标签 android layout view parent children

我有您在图片中看到的布局(抱歉,我还不能正常发布它们): 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/

相关文章:

android - 如何在 Android 中将文件上传到 GCS 时显示进度

java - 滚动 Android 中 Activity 中的所有元素

java - 创建自定义布局尺寸?

postgresql - 有什么方法可以列出与现有 postgres 模式中的表相关的所有 View

Android:使用系统图像查看器查看多个图像

java - LoginActivity 在登录期间崩溃

java - 闹钟不起作用

sql - AND 查询 m-to-n 表

grails - Grails:在Layout GSP中获取 View 名称

c# - 禁用 Android 双击 Xamarin Forms 标签