【问题标题】:Overlap other views on Camera Preview in android在android中的Camera Preview上重叠其他视图
【发布时间】:2016-09-12 22:18:18
【问题描述】:

我正在关注相机 API 的 Android 开发人员指南(现在使用 v1)。我找不到重叠视图的方法(在我的情况下,预览顶部的图像按钮/图像视图)。我正在使用框架布局。这是布局代码。

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.blackfruit.camfilters.CameraActivity"
    android:orientation="vertical"
 >

 <FrameLayout
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:id="@+id/cameraPreview"
     android:layout_weight="1">

  <ImageView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:id="@+id/imageView"
      android:src="@drawable/snap"
      android:layout_gravity="bottom|center"
      android:layout_marginBottom="20dp"
      />

 </FrameLayout>
</RelativeLayout>

我知道还有其他方法,例如使用表面视图和线性布局。但我正在解决这种方法的问题。我见过有人说这完全有效,但我的并不意味着我只看到相机预览而不是任何按钮或图像重叠。 谁能帮帮我?

【问题讨论】:

  • 详细解释“我的不”是什么意思。
  • 抱歉添加了。需要明确的是,我看到的只是预览,而不是覆盖它的图像视图。

标签: android android-camera


【解决方案1】:

经过反复试验。我以某种方式设法解决了这个问题。我用myImageView.bringToFront();

最终解决了这个问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-05-26
    • 1970-01-01
    • 2023-03-27
    • 2023-04-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多