내 안드로이드 앱에 로그인 화면이 있습니다. 내가 얻을 수 있었던 가장 가까운이android에서이 레이아웃을 수행하는 방법
나는 내가 사용 일시적으로 동일한 9.png을 (사용하는 그래픽 디자이너 나에게이 템플릿
주신이었다 내 버튼)
레이아웃과 9.png 파일의 조합으로이 문제를 해결하는 방법에 대한 아이디어가 있으십니까? 나는 모든 화면 크기를 지원하기를 원하기 때문에 정적 배경 이미지를 사용하고 싶지 않다 ...
EDIT : 로그인 부분이 확장 가능해야하는 두 개의 다른 9 패치 파일을 사용했다. 버튼의 길이는 전화 로케일에 따라 다를 수 있음). 그것들을 모으기 위해서 나는 상대적 관계 (relativelayout)를 사용했다.
을 내가 사용되는 관심, 여기에 레이아웃 (내가 단순화 할 수 있다고 생각)에 대한 :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:paddingLeft="15dp" android:paddingRight="15dp"
android:background="#ffffffff" android:gravity="center"
android:orientation="vertical">
<LinearLayout android:id="@+id/login_field_container_top"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:padding="5dp"
android:layout_centerInParent="true" android:layout_marginTop="0dp"
android:layout_marginBottom="-5dp" android:background="@drawable/login_field_container_top">
<TextView android:layout_height="wrap_content"
android:layout_width="fill_parent" android:text="@string/email" />
<EditText android:id="@+id/email" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:scrollbars="none"
android:inputType="textEmailAddress" android:singleLine="true"
android:maxLength="255" />
<TextView android:layout_height="wrap_content"
android:layout_width="fill_parent" android:text="@string/password"
android:layout_margin="5dp" />
<EditText android:id="@+id/password" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:scrollbars="none"
android:password="true" android:singleLine="true" />
</LinearLayout>
<RelativeLayout android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_gravity="right">
<LinearLayout android:id="@+id/login_field_container_bottom"
android:layout_alignParentRight="true" android:orientation="vertical"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:gravity="center" android:background="@drawable/login_field_container_bottom">
<LinearLayout android:layout_width="wrap_content"
android:layout_height="wrap_content" android:padding="1dp"
android:layout_margin="1dp" android:layout_gravity="center"
android:gravity="center" android:background="@drawable/small_button_holder">
<Button android:id="@+id/login_button" android:text="@string/login"
android:layout_margin="0dp" android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
<LinearLayout android:orientation="horizontal"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:paddingBottom="10dp" android:layout_toLeftOf="@id/login_field_container_bottom"
android:layout_alignBottom="@id/login_field_container_bottom">
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="@string/notamember"
style="@style/Subtitle" />
<Button android:id="@+id/register" android:text="@string/register"
android:layout_width="wrap_content" android:layout_height="wrap_content" />
</LinearLayout>
</RelativeLayout>
</LinearLayout>
내가 유일한 부분 내가하고 싶었던 것에 아주 가까이입니다 나는 왼쪽과 오른쪽 버튼을 정렬하기 위해 패딩을 추가해야만했다.
왜 그렇게 우리가 떨어져 갈 수있는 뭔가가 현재의 레이아웃 XML을 게시하지? –