Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Progress line of standard Seekbar doesn't appear

I have found a problem with SeekBar. On devices with Android 4,5,6 I do not have such problem, but on Samsung S8 with Android 7 problem with progress line occurs. If I remove rotation parameter, SeekBar becomes horizontal and problem disappears, but I need standard vertical SeekBar. Update: the same problem on Nexus emulator API 24 (Android 7). I have attached 2 screen shots from my app running on Android 6 (LG, Sony) and Android 7 (Samsung S8) and code:

    <SeekBar android:id="@+id/seekBar"
    android:layout_width="100dp"
    android:layout_height="42dp"
    android:background="#20FFFFFF"
    android:rotation="270"
    android:layout_gravity="center"
    >
</SeekBar>

and full code:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <ImageView
        android:id="@+id/icon"
        android:layout_width="42dp"
        android:layout_height="24dp"
        android:paddingTop="6dp"
        android:background="#20FFFFFF"
        android:layout_gravity="center"
        android:src="@drawable/iconvolume" />
    <LinearLayout
        android:layout_width="42dp"
        android:layout_height="100dp"
        android:gravity="center">

    <SeekBar android:id="@+id/seekBar"
        android:layout_width="100dp"
        android:layout_height="42dp"
        android:background="#20FFFFFF"
        android:rotation="270"
        android:layout_gravity="center"
        >
    </SeekBar>
    </LinearLayout>

</LinearLayout>

Android 7

Android 6

like image 743
Anton Avatar asked Aug 01 '17 13:08

Anton


1 Answers

i've got this problem, after try many many approach, i was found solution. Just add android:layerType="hardware" or android:layerType="software" will solve your problem

<SeekBar android:id="@+id/seekBar"
    android:layout_width="100dp"
    android:layout_height="42dp"
    android:background="#20FFFFFF"
    android:rotation="270"
    android:layerType="hardware"
    android:layout_gravity="center"
    >
</SeekBar>
like image 64
Cuong Nguyen Avatar answered Nov 15 '22 22:11

Cuong Nguyen