화면 너비의 절반으로 LinearLayout
의 너비를 설정하고 내 UI 초기화에을 동적으로 설정하고 싶습니다.런타임 중에 Android 레이아웃 객체의 크기를 조정하는 방법은 무엇입니까?
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:id="@+id/left_linear_layout"
android:layout_alignParentLeft="true"
android:layout_height="fill_parent"
android:layout_width="155dp" <!--want to set this to 1/2 screen width-->
android:orientation="vertical">
...
</LinearLayout>
<LinearLayout
android:id="@+id/right_linear_layout"
android:layout_alignParentRight="true"
android:layout_height="fill_parent"
android:layout_width="385dp"><!--want to set this relative to screen width as well-->
....
</LinearLayout>
</RelativeLayout>
,이 문제가 해결 될 수 View
대신 Layout
를 사용 : 나는 계층 구조는 다음과 같다하는 RelativeLayout
가 LinearLayout
감싸 있나요? 어떤 제안이라도 감사드립니다!