ETC

[Android] scrollbarStyle

MuGrammer 2015. 2. 4. 18:08

[상황] GridView 에 padding을 주었더니 scrollbar가 padding 안쪽에 생겨 보기가 몹시 거북했다.

[노력]

    1. padding을 우선 제거. Top,Bottom,Left만 지정하고 Right는 item에서 지정하도록.. 실패..

    2. horizontalSpacing 등등 이런 저런 잡다한 시도를 해보았지만.. 딱히 맘에 들지 않아 실패..

[해결] GridView에 android:scrollbarStyle="outsideInset" 으로 설정

android:scrollbarStyle

Controls the scrollbar style and position. The scrollbars can be overlaid or inset. When inset, they add to the padding of the view. And the scrollbars can be drawn inside the padding area or on the edge of the view. For example, if a view has a background drawable and you want to draw the scrollbars inside the padding specified by the drawable, you can use insideOverlay or insideInset. If you want them to appear at the edge of the view, ignoring the padding, then you can use outsideOverlay or outsideInset.

Must be one of the following constant values.

Constant

Value

Description

insideOverlay

0x0

Inside the padding and overlaid

insideInset

0x01000000

Inside the padding and inset

outsideOverlay

0x02000000

Edge of the view and overlaid

outsideInset

0x03000000

Edge of the view and inset

This corresponds to the global attribute resource symbol scrollbarStyle.

 

[출처] : http://developer.android.com/reference/android/view/View.html#attr_android:scrollbarStyle

 

 

[교훈] 노력이 모든걸 해결해주진 않는다.

반응형