ロゴ2のテキストとログインボタンを使用してログインページのUIを作成しようとしましたが、電話ポートレートモードでは非常に便利でしたが、そしてタブレットは問題を開始しました。相対レイアウトとリニアレイアウトでポートレートからランドスケープに切り替えるときに問題が発生する
私は、これはポートレートモードで完璧に動作しますが、我々は、風景の中に回転させるように画像サイズを小さく2つのソリューション
1.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/relativelayoutparent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#fed2db"
android:orientation="vertical"
>
<RelativeLayout
android:id="@+id/linearlayout_parents"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/relativelayoutbasic"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/margin20"
android:layout_marginRight="@dimen/margin20"
android:layout_centerInParent="true"
>
<EditText
android:id="@+id/userName"
android:inputType="text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="[email protected]"
android:hint="UserName"
android:drawableStart="@mipmap/ic_launcher"
android:drawablePadding="10dp"
android:background="@null"
android:layout_marginTop="10dp" />
<View
android:id="@+id/view"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#f7f7f7"
android:layout_below="@id/userName"
android:layout_marginTop="10dp" />
<EditText
android:id="@+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/view"
android:inputType="textPassword"
android:hint="Password"
android:text="[email protected]"
android:drawablePadding="10dp"
android:background="@null"
android:drawableStart="@mipmap/ic_launcher"
android:layout_marginTop="10dp" />
<Button
android:id="@+id/buttonLogin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/password"
android:background="#f7f7f7"
android:text="Login"
android:textColor="@android:color/black"
android:textAllCaps="false"
android:textStyle="bold"
android:textSize="17sp"
android:layout_marginTop="10dp" />
<Button
android:id="@+id/buttonForgotPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/buttonLogin"
android:layout_marginTop="10dp"
android:text="Forgot Password ?"
android:textColor="@android:color/white"
android:textAllCaps="false"
android:background="@null" />
</RelativeLayout>
<ImageView
android:id="@+id/imageview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_launcher"
android:layout_marginTop="@dimen/margin20"
android:layout_above="@id/relativelayoutbasic"
android:layout_centerHorizontal="true"/>
</RelativeLayout>
</RelativeLayout>
を得ました。
以下の例では、私は、次のソリューション
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/relativelayoutparent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#3996db"
android:orientation="vertical"
>
<ScrollView
android:id="@+id/linearlayout_parentscroll"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/linearlayout_parents"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:id="@+id/imageview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_launcher"
android:layout_marginTop="@dimen/margin20"
android:layout_gravity="center_horizontal"/>
<RelativeLayout
android:id="@+id/relativelayoutbasic"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/margin20"
android:layout_marginRight="@dimen/margin20"
>
<EditText
android:id="@+id/userName"
android:inputType="text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="[email protected]"
android:hint="UserName"
android:drawableStart="@mipmap/ic_launcher"
android:drawablePadding="10dp"
android:background="@null"
android:layout_marginTop="10dp" />
<View
android:id="@+id/view"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#f7f7f7"
android:layout_below="@id/userName"
android:layout_marginTop="10dp" />
<EditText
android:id="@+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/view"
android:inputType="textPassword"
android:hint="Password"
android:text="[email protected]"
android:drawablePadding="10dp"
android:background="@null"
android:drawableStart="@mipmap/ic_launcher"
android:layout_marginTop="10dp" />
<Button
android:id="@+id/buttonLogin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/password"
android:background="#f7f7f7"
android:text="Login"
android:textColor="@android:color/black"
android:textAllCaps="false"
android:textStyle="bold"
android:textSize="17sp"
android:layout_marginTop="10dp" />
<Button
android:id="@+id/buttonForgotPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/buttonLogin"
android:layout_marginTop="10dp"
android:text="Forgot Password ?"
android:textColor="@android:color/white"
android:textAllCaps="false"
android:background="@null" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>
下記の例を示して示し。このソリューションでは、アンドロイド:layout_centerInParent = "true"というプロパティを使用することはできません 相対レイアウトのため、ソリューション1のようにログインテキストフィールドを中心にすることはできません。スクロールもしていますが、大きな画面では機能しません。中央には表示されないためです。
B.他の多くの問題を引き起こすため、スクロールビュー内で相対レイアウトを使用することはできません。
私は非常に多くの時間を費やしており、非常に多くのスタックオーバーフロー参照やその他も使用していますが、何も問題はありません。
どうか作業を進めてください。 ありがとうございます...
あなたの問題は何ですか? – LightYearsBehind