2010年11月30日火曜日

Andoid android:scrollbarSize は バーの幅ではありません。

以前スクロールバーをカスタマイズするエントリを書きましたが、

「Android ScrollBar (ScrollView) スクロールバーをカスタマイズ」

 android:scrollbarSize はバーの幅ではなかったのです!

 いや、あの、リファレンス
 http://developer.android.com/reference/android/view/View.html#attr_android:scrollbarSize
 には、

  "Sets the width of vertical scrollbars and
  height of horizontal scrollbars."

 ってあるんですよ。バーの幅だと思うでしょ。。。

 それが、

  1. <ScrollView  
  2.     android:layout_width="fill_parent"  
  3.     android:layout_height="fill_parent"  
  4.     android:scrollbarSize="100dip"  
  5.    >  


とやっても、見た目に変化なし。





で、結論から言うと、

  android:scrollbarThumbVertical
 


  android:scrollbarTrackVertical

を定義して、かつ

android:scrollbarStyle に

 "insideInset" か "outsideInset"

を設定しないとだめです。

# デフォルトは insideOverlay だから気づきにくかった。。。



  1. <ScrollView  
  2.     android:layout_width="fill_parent"  
  3.     android:layout_height="fill_parent"  
  4.     android:scrollbarSize="100dip"  
  5.     android:scrollbarStyle="insideInset"  
  6.     android:scrollbarThumbVertical="@drawable/scrollbar_thumb"  
  7.     android:scrollbarTrackVertical="@drawable/scrollbar_track"  
  8.    >  


この場合は、こうなります。




こういうのなんて言うのかな。
inset の幅?


 

0 件のコメント:

コメントを投稿