2016-08-31 8 views
0

스크롤 가능한 가로 진행률 막대를 만들려고합니다.스크롤 가능한 진행률 막대

따라서 수평 스크롤보기에 진행률 표시 줄을 놓고 진행 막대 최소 너비를 1000으로 설정합니다 (내 화면 너비의 두 배입니다).

하지만 여전히 스크롤 막대를 스크롤 할 수 없습니다 ...

는 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> 

어떤 생각? 감사합니다.

+0

.. 당신은 무엇을 위해 그것을 필요합니까? – pskink

+0

@pskink 나는 progressbar를 확장하는 사용자 정의 진행률 표시 줄이 있으며, 내 스크롤바에 마커가 있습니다. 스크롤 할 수있게 만드는 방법을 알고 있습니까? – AsfK

답변

1

하나의 변경 사항으로 솔루션을 시도했지만 wrap_content에 horizontalscrollview의 너비를 지정했습니다. 여기
내 레이아웃입니다

<?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

대단히 감사합니다! 나는 스크롤바 태그에 많은 시간을 보냈다. – AsfK

0

설정 HorizontalScrollView의 layout_width wrap_content 에 :

는 거의 의미가 "스크롤"진행률 표시 줄을 만들 수
... 
<HorizontalScrollView 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
...