나는 아래 그림과 같은 레이아웃을 디자인 할 :안드로이드에서 한 레이아웃에 버튼 반을, 다른 레이아웃에 반을 표시하는 방법은 무엇입니까?
나는 상대 레이아웃을 사용하여 그것을 할 시도했지만 나는 해결책을 마련하지 않았다. 모든 장치 화면에서 동일한 위치에 있어야합니다. 나는 그것을 어떻게 성취 할 수 있는가 ??? 다음 코드를 사용해 보았습니다.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<RelativeLayout
android:id="@+id/relative_layout_top"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/obaz" >
</RelativeLayout>
<RelativeLayout
android:id="@+id/relative_layout_bottom"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/relative_layout_top"
android:background="@drawable/obaz2" >
<Button
android:id="@+id/bt_atoz"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginTop="-20dp"
android:background="@drawable/button_active" />
</RelativeLayout>
</RelativeLayout>
제안 사항을 보내주십시오.
2 아이 뷰와 1 주 기준으로 레이아웃 중력 가운데 버튼을 center_vertical 및 기타 2 (어린이 2 위에 가진 & 아래) 부모 FrameLayout이를 사용해보십시오 당신이 원하는 정렬 –
^이 답변입니다. –
정답 일지 모르지만 문제는 응답하지 않습니다. 즉, 장치를 hdpi에서 xdpi로 변경하면 작동하지 않습니다. – androidcodehunter