2010년 1월 27일 수요일

[Android] 탭의 사이즈 줄이기







위의 그림처럼 탭의 사이즈를 줄이는 방법입니다.

탭을 생성한 후

mTabHost.getTabWidget().getChildAt(0).setLayoutParams(new LinearLayout.LayoutParams(100, 30, 1));

width와 height 값을 설정하고 마지막 1은 weight를 나타낸다


아래는 API 설명이다.

public LinearLayout.LayoutParams (int width, int height, float weight)

Since: API Level 1
Creates a new set of layout parameters with the specified width, height and weight.
Parameters
width
the width, either FILL_PARENT, WRAP_CONTENT or a fixed size in pixels
height
the height, either FILL_PARENT, WRAP_CONTENT or a fixed size in pixels
weight
the weight

댓글 2개: