제대로 처리하는 방법을 모르기 때문에 시간 낭비 일뿐입니다. 기본적으로 사용자가 원하는대로 입력 할 수있는 사용자 정의 입력보기를 원합니다. 그 아래에서 겹치기를 원치 않는 2 개 (또는 그 이상)의 버튼을 배치하고 싶습니다. 사용자 정의보기 맨 위. 너비와 높이를 하드 코딩하지 않으려 고하기 때문에 버튼이 내용으로 이동해야하고 사용자 정의보기가 나머지 높이를 차지하도록 지정하는 방법이 있습니까?컨트롤 정렬
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<com.example.myapp.DrawView
android:id="@+id/drawView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true" />
<Button
android:id="@+id/buttonSave"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:text="@string/save" />
<Button
android:id="@+id/buttonQuery"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:text="@string/query" />
</RelativeLayout>
이 실제로 가능 : 나는 모든 버튼이 같은 높이가 기대 때문에, 나는
여기에 내 현재 레이아웃의 ... 참고로 그 중 하나의 높이를 복용 어떻게 든 일을해야한다고 생각 더러운 방식으로 해킹하지 않고도 원하는 것을 쉽게 얻을 수 있습니까? 당신이Buttons
가 다른 레이아웃을 마무리해야 할 것 같다고의 높이에 대해 확실하지 않은 경우
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<Button
android:id="@+id/buttonSave"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:text="@string/save" />
<Button
android:id="@+id/buttonQuery"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:text="@string/query" />
<com.example.myapp.DrawView
android:id="@+id/drawView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_above="@id/buttonSave" />
</RelativeLayout>
(같은 LinearLayout
) 다음은을 배치하십시오 Buttons
위의 사용자 정의보기
쿨 친구! 내가 할 수 있다면 +10 줄거야! :) –
DrawView @Mihai Todor 앞에 Button을 선언하고 싶지 않다면, 대신에 그것들을'res/values / ids.xml' 파일에 선언 할 수 있습니다. 그렇게하면 단추/그림보기를 선언하는 순서가 전혀 중요하지 않습니다. id는 이미 레이아웃 파일 외부에 있습니다. – scriptocalypse