开发者

Android ListView Scrollbar

I created a list view.I need to increase the width of the vertical scrollbar. I changed android:scrollbarSize. But it is not working .Also want to 开发者_开发问答decrease length of scrollbar thumb.Is it posiible. Please help me.

<LinearLayout android:id="@+id/LinearLayout01" 
 android:layout_width="fill_parent" android:layout_height="fill_parent" 
 xmlns:android="http://schemas.android.com/apk/res/android">

<ListView 
 android:id="@+id/list_view"
 android:layout_width="fill_parent"
 android:layout_height="wrap_content"
 android:scrollbars="vertical"
 android:scrollbarAlwaysDrawVerticalTrack="true"
 android:scrollX="0px"
 android:scrollY="0px"
 android:background="#515151"
 android:layout_weight="1"
 android:scrollbarStyle="outsideOverlay"
 android:divider="#FFF"
 android:fadeScrollbars="false"
 android:scrollbarSize="20dip"/>

 </LinearLayout>


Your scrollbar will scale to the width/height of the resource that you specify for android:scrollbarTrackHorizontal and android:scrollbarTrackVertical.

This seems to be the only way to do it that I can figure out right now, and I'm not going to monkey around with it anymore ;)

So if you want an 8px wide horizontal track, and a 12px high vertical track. Create a PNG that is 8px wide for the horizontal track. Create a PNG that is 12px high for the horizontal track. Your nine patches for the android:scrollbarThumbHorizontal and android:scrollbarThumbHorizontal will automatically scale inside of these images.

<item name="android:scrollbarTrackHorizontal">@drawable/png_12px_high</item>
<item name="android:scrollbarTrackVertical">@drawable/png_8px_wide</item>


I asked this same question and didn't receive any answer: android ignores scrollbarsize

Then, there was an issue opened but the closed it stating "working as intended": http://code.google.com/p/android/issues/detail?id=7711&can=1&q=scrollbar%20width&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars

So far, I haven't seen a solution, tho I haven't researched that much. If you find any solution, please update this question.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜