저는 Android가 처음입니다. 활동의 단편 아래에 버튼을 표시합니다.
<LinearLayout android:layout_width="wrap_content"
android:layout_height="wrap_content"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/relativeLayout">
<fragment android:layout_width="fill_parent"
android:layout_height="match_parent"
android:name="pl.nscr.playwatch.MainActivity$WatchListFragment"
android:id="@+id/watchlist"/>
<Button android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Start service"/>
</LinearLayout>
지금 내 문제는 단편이 활동의 전체 사용 가능한 높이에 걸쳐이다 : 나는 아직 작동하지 않는 매우 간단한 레이아웃을 가지고있다. 그 아래에있는 버튼을 볼 수 있기를 원합니다. 그러나 실제로이 것을 배치하는 방법을 알지 못합니다.
RelativeLayout을 사용해 보았지만,보기 흉한 조각 위의 버튼이 나타났습니다. 내가 도대체 뭘 잘못하고있는 겁니까?
업데이트 분명히 그것은 바보 같은 실수였다. RelativeLayout으로 다시 변경되었지만 레이아웃의 너비와 높이가 'fill_parent'로 설정되어 있고 모든 것이 예상대로 작동합니다.
<RelativeLayout android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/relativeLayout">
<fragment android:layout_width="fill_parent"
android:layout_height="match_parent"
android:name="pl.nscr.playwatch.MainActivity$WatchListFragment"
android:id="@+id/watchlist"
android:layout_above="@+id/btnStartService"/>
<Button android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:id="@id/btnStartService"
android:text="Start service"/>
</RelativeLayout>