0
完全不同的我建了一個簡單的,一旦屏幕Android應用程序 - 它有edittext
盒的用戶名,密碼等,這是它的外觀在AVD /月蝕:佈局Android應用程序在設備上
然而,當我把它部署到我的HTC EVO 4G,這是它的外觀:
如果它的事項,項目建設目標是Android 4.0的在Eclipse中,但我的HTC EVO 4G正在運行, roid 2.3.3。這是造成這種劇烈的差異?不應該向後兼容佈局嗎?
我才意識到這一點:
當我轉動我的設備到橫向視圖,我只看到電子郵件的EditText,不過,當設備處於縱向,我只看到密碼的EditText(如上圖) 。
這裏是我的main.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="40dp"
android:layout_weight="0.34"
android:scaleType="center"
android:src="@drawable/shift" />
<TextView
android:id="@+id/txtLogin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="20dp"
android:layout_marginTop="20dp"
android:text="@string/login"
android:textAppearance="?android:attr/textAppearanceMedium" />
<FrameLayout
android:id="@+id/frameLayout1"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" >
<TextView
android:id="@+id/txtEmail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="20dp"
android:text="@string/email"
android:textAppearance="?android:attr/textAppearanceSmall" />
<EditText
android:id="@+id/txtEmail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="50dp"
android:inputType="textEmailAddress" >
</EditText>
<TextView
android:id="@+id/txtPass"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="120dp"
android:text="@string/password"
android:textAppearance="?android:attr/textAppearanceSmall"
android:hint = "Email address" />
<EditText
android:id="@+id/editText2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="150dp"
android:inputType="textPassword"
android:hint="Password"/>
<Button
android:id="@+id/btnLogin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="200dp"
android:text="Login" />
<requestFocus/>
</FrameLayout>
</LinearLayout>