2016-08-31 3 views
0

Ich versuche einen scrollbaren horizontalen Fortschrittsbalken zu erstellen.Scrollbare Fortschrittsbalken

Deshalb habe ich den Fortschrittsbalken in horizontale Bildlaufansicht und setzen Fortschrittsbalken minimale Breite auf 1000 (es ist doppelt meine Bildschirmbreite).

Aber ich kann immer noch die Bildlaufleiste nicht bewegen ...

Die XML:

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

    <HorizontalScrollView 
     android:layout_width="1000dp" 
     android:layout_height="wrap_content" 
     android:measureAllChildren="true" 
     android:background="#e3ece5"> 

     <ProgressBar 
      style="@android:style/Widget.DeviceDefault.Light.ProgressBar.Horizontal" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:visibility="visible" 
      android:id="@+id/progressBar" 
      android:progress="50" 
      android:minWidth="1000dp"/> 
    </HorizontalScrollView> 
</LinearLayout> 

Jede Idee? Danke!

+0

es wenig Sinn machen "scrollable" Fortschrittsbalken zu schaffen .. was brauchen Sie es? – pskink

+0

@pskink Ich habe benutzerdefinierte Fortschrittsbalken, die Fortschrittsbalken erweitert, und ich habe Markierungen auf meiner Bildlaufleiste .. haben Sie eine Idee, wie man es scrollbar machen? – AsfK

Antwort

1

Ich habe versucht, Ihre Lösung mit einer Änderung, Breite von horizontalscrollview zu wrap_content zuweisen.
Hier ist mein Layout

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

    <HorizontalScrollView 
     android:layout_width="wrap_content" 
     android:scrollbars="horizontal" 
     android:layout_height="wrap_content"> 

     <ProgressBar 
      style="@android:style/Widget.DeviceDefault.Light.ProgressBar.Horizontal" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:visibility="visible" 
      android:id="@+id/progressBar" 
      android:progress="50" 
      android:secondaryProgress="100" 
      android:minWidth="1000dp" 
      android:focusable="false" 
      android:nestedScrollingEnabled="false" /> 
    </HorizontalScrollView> 

</LinearLayout> 
+0

Vielen Dank! Ich habe viel Zeit mit dem Scrollbar-Tag verbracht – AsfK

0

Set layout_width von HorizontalScrollView zu wrap_content:

... 
<HorizontalScrollView 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
...