Search code examples
androidandroid-constraintlayoutandroid-progressbarexoplayer2.x

vertical progress bar cannot be assigned to end of the layout


I'm trying to implement vertical progress bar. But the progress bar doesn't seems to be moving to right end of the screen.

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/idGestureContainer"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".zzzz_dummy.GestureEvents">

    <ProgressBar
        android:id="@+id/determinateBar"
        style="@android:style/Widget.ProgressBar.Horizontal"
        android:layout_width="500dp"
        android:layout_height="10dp"
        android:max="100"
        android:progress="50"
        android:rotation="270"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>

Kindly anyone help me on moving this pregress bar to start and end of the view. I need both, one for volume and one for brightness. Thank you in advance.

enter image description here


Solution

  • Ok one thing you can do is wrap it.

    <FrameLayout
            android:layout_width="20dp"
            android:layout_height="300dp"
            android:layout_marginEnd="50dp"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent" // for left
            // app:layout_constraintStart_toStartOf="parent" // for right
            app:layout_constraintTop_toTopOf="parent">
    
            <ProgressBar
                android:id="@+id/idVolumeControl"
                style="@android:style/Widget.ProgressBar.Horizontal"
                android:layout_width="290dp"
                android:layout_height="match_parent"
                android:max="100"
                android:progress="50"
                android:rotation="270" />
    
        </FrameLayout>