【问题标题】:Position SeekBar on vertical edge of another View将 SeekBar 定位在另一个 View 的垂直边缘
【发布时间】:2015-11-02 19:31:04
【问题描述】:

我正在使用 Android 的 SeekBar,拼命尝试实现这样的 SeekBar 位于另一个视图的垂直边缘的布局。

鉴于其他应用程序遵循这种模式,我知道这会起作用,我只是不知道我需要哪些属性和值才能实现它。

截至目前,情况如下:

虽然我的想法看起来更像这样:

SeekBar的xml标签如下:

    <SeekBar
        android:id="@+id/seekBar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:maxHeight="2dp"
        android:padding="0dp"
        app:layout_anchor="@id/appbar" />

【问题讨论】:

    标签: android android-layout android-design-library android-seekbar android-coordinatorlayout


    【解决方案1】:

    将搜索栏移出 AppBarLayout,并使用以下属性:

    <SeekBar
        android:id="@+id/seekBar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:layout_anchorGravity="bottom"
        android:layout_gravity="center_vertical"
        app:layout_anchor="@id/appbar" />
    

    【讨论】:

    • 尝试分配更高的 android:elevation 值。
    • 当然可以,但我尝试支持 android api lvl >=16 :(
    • 您正在测试哪个 API?我相信在 API
    • 我在 22 号测试。如果你说的是真的,我会在 layout-v21 中添加 android:elevation,谢谢!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-04-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多