gpt4 book ai didi

Android多个垂直seekBars

转载 作者:行者123 更新时间:2023-12-04 09:16:23 26 4
gpt4 key购买 nike

我正在尝试为应该有 2 个垂直 SeekBar 的 Android 应用程序设计一个 View ,这是我的 XML:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/control_view_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
android:background="#0099cc"
android:orientation="horizontal"
tools:context=".FullscreenActivity">

<SeekBar
android:id="@+id/seekBarL"
android:rotation="270"
android:splitTrack="false"
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="match_parent" />

<SeekBar
android:id="@+id/seekBarR"
android:rotation="270"
android:splitTrack="false"
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="match_parent" />
</LinearLayout>
在 android studio 的预览和设备上它看起来很好,但是每当我尝试更改左侧的位置时 SeekBar ,正确的会被触发。无论我将拇指放在哪里,唯一正确的人都会使用react。有没有人有过这种奇怪的行为?

最佳答案

我不知道为什么会发生这种情况(这很奇怪)但我知道如何修复它。不要把SeekBars放在同一个容器里,放在FrameLayout它会起作用。

<?xml version="1.0" encoding="utf-8"?>
<androidx.appcompat.widget.LinearLayoutCompat xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/control_view_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#0099cc"
android:orientation="horizontal">

<FrameLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">

<SeekBar
android:id="@+id/seekBarR"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:rotation="270" />

</FrameLayout>

<FrameLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">

<SeekBar
android:id="@+id/seekBarL"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:rotation="270" />

</FrameLayout>

</androidx.appcompat.widget.LinearLayoutCompat>

关于Android多个垂直seekBars,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63192721/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com