안녕하세요 레이아웃작업을 하다 모르는게 있어 질문드립니다
예를들어
linearlayout 가 horizontal 인경우 자식하나만 비율을 먹이고 싶습니다
예를들어
뷰 뷰
<----------------------------->< ------------->
70 % 30 %
이런 뷰를
<----------------------------> 공백
70 % 30%
이렇게 바꾸고 싶습니다
다시한번 질문드리면
이효과를 <layoutgroup~~ > <view~~70%> <view~~30%> </layoutgroup~~~>
<layoutgroup~~ > <view~~70%> </layoutgroup~~~> 이렇게도 구현하는 방법을 알고 싶습니다
읽어주셔서 감사합니다 좋은하루되십시요`~!!
그런건 안됩니다. 정확한 값을 주고 뷰를 하나 쓰시던지 또는 만짜님 말씀처럼 뷰를 두개써서 비율을 적어줘야 합니다.
뷰가 하나있고 그 뷰가 weight를 가지면 레이아웃을 가득채우게 됩니다.
가능은 합니다.. parent에 weight_sum을 1로 정하시고, child에 layout_weight 을 .7로 주면.. 70%를 차지하게 됩니다.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:weightSum="1"
android:background="#ffffffff">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0.7"
android:background="#ff000000"/>
</LinearLayout>
<view android:layout_width="0dp" android:layout_weight="7" .../>
<view android:layout_width="0dp" android:layout_weight="3" ..../>
그럼 왼쪽은 70% 오른쪽은 30%가 되죠. 두번째 뷰에 텍스트같은 값이나 배경같은걸 안주면 공간만 차지하고 있겠죠?