我正在嘗試實現登錄表單。我嘗試過使用不同的佈局,但我無法制作如下圖所示的登錄表單。Android漂亮的登錄表單
==================================================================================
=
=
=
=
=
= =============================================
= = =
= = User Name: Input box =
= = =
= = =
= = =
= = Password : Input box =
= = =
= =============================================
=
=
=
=
=
=
=
==========================================================================================
我試過網格佈局,但是當我畫出用戶名和密碼的背景的中心部分。我也使用了gridlayout,結果輸出屏幕超出範圍。 (意思我不能)看到全屏。 這是我的xml代碼。
<GridLayout xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/firstdesktop"
android:columnCount="3"
android:orientation="vertical"
android:rowCount="3"
tools:context=".SplitActivity" >
<GridLayout
android:layout_width="560dp"
android:layout_height="291dp"
android:layout_column="1"
android:layout_gravity="left"
android:layout_row="1"
android:columnCount="2"
android:orientation="vertical"
android:rowCount="3" >
<TextView
android:id="@+id/TextView02"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="1"
android:layout_gravity="left|bottom"
android:layout_row="0"
android:text="@string/txtUserName"
android:textColor="#FFFFFF"
android:textSize="20dp"
android:typeface="monospace" />
<EditText
android:id="@+id/editText1"
android:layout_height="35dp"
android:layout_column="1"
android:layout_gravity="right|bottom"
android:layout_row="0"
android:background="#FFFFFF"
android:ems="10"
android:inputType="textPersonName" />
<TextView
android:id="@+id/TextView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="1"
android:layout_gravity="left|bottom"
android:layout_row="1"
android:shadowColor="#FFFFFF"
android:shadowDx="1"
android:shadowDy="1"
android:shadowRadius="2.0"
android:text="@string/txtPass"
android:textColor="#FFFFFF"
android:textSize="20dp"
android:typeface="monospace" />
<EditText
android:id="@+id/editText2"
android:layout_height="35dp"
android:layout_column="1"
android:layout_gravity="left|bottom"
android:layout_row="2"
android:background="#FFFFFF"
android:ems="10"
android:inputType="textPassword" />
<Button
android:id="@+id/button1"
style="@style/ButtonText"
android:layout_width="215dp"
android:layout_height="wrap_content"
android:layout_column="1"
android:layout_gravity="left|bottom"
android:layout_row="3"
android:background="@drawable/redbutton"
android:text="@string/btnLogin" />
<Space
android:layout_width="320dp"
android:layout_height="1dp"
android:layout_column="0"
android:layout_row="0" />
<Space
android:layout_width="170dp"
android:layout_height="1dp"
android:layout_column="1"
android:layout_row="0" />
<Space
android:layout_width="48dp"
android:layout_height="1dp"
android:layout_column="1"
android:layout_row="0" />
<Space
android:layout_width="1dp"
android:layout_height="1dp"
android:layout_column="1"
android:layout_row="0" />
<Space
android:layout_width="100dp"
android:layout_height="1dp"
android:layout_row="1" />
</GridLayout>
,這裏是我的仿真器性能。 目標的Android 4.1 - API Level16 SD卡:尺寸:500Mib 皮膚:分辨率:1280 x 800
我照着我的平板電腦尺寸落戶模擬器的屏幕尺寸。 (1280 x 800) 如果還有其他方法,請告訴我..? 請幫助我,如果你可以..謝謝。
使用RelativeLayout – 2012-08-13 11:43:56