android - 在 Android 中将 SeekBar 置于 Imageview 之上?

标签 android

问候,

我在 Android 中有以下布局。我正在努力做到这一点,以便搜索栏显示在图像之上(我有一些代码可以使它可见和不可见(或者更确切地说是消失)。

我想知道是否有人可以告诉我如何定位它,以便搜索栏越过 imageview,从而允许 imageview 占据整个屏幕。

谢谢

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<.imageOverlay android:id="@+id/surface"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" />

<RelativeLayout
 android:layout_width="fill_parent"
 android:layout_height="fill_parent"
>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 android:orientation="vertical"
 android:layout_width="fill_parent"
 android:layout_height="fill_parent"
>

<SeekBar
 android:id="@+id/seekbar"
 android:layout_width="100px"
 android:layout_height="wrap_content"
 android:layout_gravity="center_horizontal"
 android:max="255"/>

<ImageView
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:id="@+id/surfaceimage"
 android:scaleType="fitXY"
  />

最佳答案

它与以下内容一起工作 - 我添加了 framelayout 而不是 linearlayout。

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<.imageOverlay android:id="@+id/surface"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" />


<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"     android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>

<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
 android:id="@+id/surfaceimage"
 android:scaleType="fitXY"
  />
  <SeekBar
android:id="@+id/seekbar"
android:layout_width="100px"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:max="255"/>


</FrameLayout>
</RelativeLayout>

关于android - 在 Android 中将 SeekBar 置于 Imageview 之上?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1916665/

相关文章:

java - 如何使用 andengine 创建警告对话框

android - Flutter - 使用 ACTION_EDIT Intent 时的 PlatformException

java - 找出某个类抛出了哪些异常

android - 来自 AppCompatDelegateImplV7.createSubDecor() 的间歇性 NullPointerException

java - 如何在 Firestore 中设置外键?

java - 从字符串中获取子字符串(我从文本文件中获取字符串)

java - 如何加密和解密大视频文件

android - jetpack compose shadow 奇怪的行为

java - 如何通过单选按钮更改另一个 Activity 中的文本

Android Studio Gradle 代理设置