화면의 가운데에있는 TextView의 왼쪽에 Button을 레이아웃하려고합니다. 내 레이아웃은 다음과 같습니다.RelativeLayout에서 layout_toLeftOf를 사용하여 레이아웃 한 버튼이 표시되지 않습니다.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="foo"
android:id="@+id/center"
/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Left button"
android:layout_toLeftOf="@id/center" />
</RelativeLayout>
불행히도 버튼이 나타나지 않습니다. 다음과 같은 결과가 나타납니다.
보시다시피 버튼이 표시되지 않습니다. layout_toRightOf를 사용하면 작동합니다. 그러면 버튼이 예상대로 TextView 오른쪽에 나타납니다.
내가 여기서 잘못하고있는 아이디어가 있습니까?
게시물을 통해 안드로이드의 레이아웃에 대해 거의 알지 못한다는 것을 알게되었습니다. 유용한 포인터를 가져 주셔서 감사합니다. – rodion
@CommonsWare - 예전에 대답 해 봤지만이 답변이 거의 주어지지 않았고 찾기가 얼마나 힘든지 놀랍습니다. 정말 고맙습니다! LinearLayouts에 정크를 재 작업 한 날을 저장했습니다. –
@WesWinn :이 질문은 너무 오래되었지만, 스크린 샷에서 본 것처럼 에뮬레이터가 본 모습을 잊어 버렸습니다. :-) 도움이 되었다니 기쁜 소식입니다! – CommonsWare