[xml]
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="25dp">
<GridView
android:id="@+id/gridview
android:layout_width="match_parent"
android:layout_height="match_parent"
android:columnWidth="176dp"
android:numColumns="6"
android:stretchMode="columnWidth">
</GridView>
<com.example.CustomView
android:id="@+id/customview"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</FrameLayout>
1의 경우의수와 2의 경우의수가 존재한다면 1의 경우의수에는 커스텀뷰의 width를 700, 2의 경우의 수 일떄는 커스텀뷰의 width를 match_parent로 주려고 합니다.
if(경우의수1) {
final int width = (int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 240, getResources().getDisplayMetrics());
FrameLayout.LayoutParams layoutParams = new LayoutParams(width, ViewGroup.MATCH_PARENT);
customView.setLayoutParams(layoutParams);
} else {
FrameLayout.LayoutParams layoutParams = new LayoutParams(ViewGroup.MATCH_PARENT, ViewGroup.MATCH_PARENT);
customView.setLayoutParams(layoutParams);
}
이런식으로 초기에 로딩될 때 사이즈를 조정하고, 버튼1,2,3,4가 존재하면
버튼을 클릭하여 경우의수에 맞게 커스텀뷰의 사이즈를 조정하고 싶은데,
초기값의 width와 height가 MATCH_PARENT일땐 상관없는데,
초기값의 width가 700, height가 MATCH_PARENT일때는
사이즈가 바뀌지 않고 있습니다..
제가 코드를 잘못짜고 있는걸까요..방법이 없을까요?
답변 부탁드립니다.ㅠ