0
다른 활동을 포함하는 일부 활동을 XML로 그리는 중입니다. 상대 크기를 사용하여이 작업을 수행하려고합니다. 각 상자의 화면 높이의 절반을 지정하십시오. 이 작업을 수행하는 올바른 방법은 초기 높이를 0px로 설정하고 layout_weight를 사용하는 것이지만 다음 예제가 작동하지 않는다는 것을 이해합니다. 나는 그것이 두 개의 동일한 직사각형을 그릴 것으로 예상하고 화면의 다른 수직 반쪽에 (/ 드로어 블/사진 RECT에 정의) 화면이 비어있는 경우 :android : layout_weight to work을 얻을 수 없습니다.
이<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView
android:src="@drawable/rect"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:scaleType="fitXY"
android:layout_width="fill_parent"
android:layout_height="0px"
android:layout_weight="1"/>
<ImageView
android:src="@drawable/rect"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_width="fill_parent"
android:scaleType="fitXY"
android:layout_height="0px"
android:layout_weight="1"/>
</RelativeLayout>
사람이 어떤 아이디어가 있습니까?
[Mark Murphy] (http://is.gd/1Y2DM) –
에 따르면이 방법을 사용할 수 있습니다. Hmmm, 그 조언은 LinearLayout을위한 것이기 때문에 작동하지 않을 수도 있지만 RelativeLayout을 사용합니다. 두 가지 제안 : 1) 둘 다 wrap_content를 사용하려면 2) 첫 번째에는 줄 바꿈 내용을 사용하고 두 번째 줄에는 fill_parent를 사용합니다. – iniju
layout_height를 의미합니다. – iniju