2

Actually I'm working on an Android application and we want to run our app only on devices and tablets(All screen sizes)..... so please clarify my below questions

1. the question is I know that for supporting different screens, I have to create a different layout xml ,but I think Android Studio provide the direct shortcut to create a xml for the desired screens(check image-1...some where highlight portion)

enter image description here 2. I installed some plugin(Batch Drawable import) by this plugin I scaled my image(Check image-2) in six format, so should I keep all six format of image or some...because I am targeting only devices and Tablets enter image description here 3. In my Activity there are some Edittext at bottom of the screen and when I enter some thing into the Edittext, then my Toolbar moves upwards(out of the screen)....so should I use scrollView or not for avoiding this ?

NOTE:1 I already tried this android:windowSoftInputMode="adjustPan|adjustResize"

Edit: xml for the Thrid Question:

<android.support.v7.widget.AppCompatImageView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:src="@drawable/logo"
    android:id="@+id/logo1"
    android:layout_marginTop="55dp"
    android:layout_below="@+id/toolbar1"
    />
<android.support.v7.widget.CardView
    android:layout_width="match_parent"
    android:layout_height="70dp"
    card_view:contentPadding="0dp"
    card_view:cardPreventCornerOverlap="false"
    card_view:cardMaxElevation="3dp"
    card_view:cardUseCompatPadding="true"
    card_view:cardCornerRadius="4dp"
    card_view:cardElevation="4dp"
    android:layout_marginLeft="10dp"
    android:layout_marginRight="10dp"
    card_view:cardBackgroundColor="@color/textViewBackground"
    android:layout_below="@+id/logo1"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true"
    android:layout_marginTop="40dp"
    android:id="@+id/cardView">
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="60dp">
        <android.support.v7.widget.AppCompatImageView
            android:layout_height="match_parent"
            android:layout_width="wrap_content"
            android:paddingLeft="8dp"
            android:id="@+id/phone_icon"
            android:paddingBottom="4dp"
            android:src="@drawable/email_icon"/>

        <android.support.v7.widget.AppCompatImageView
            android:layout_height="match_parent"
            android:layout_width="wrap_content"
            android:paddingLeft="35dp"
            android:paddingBottom="4dp"
            android:src="@drawable/symbol"
            android:id="@+id/symbol"/>

        <android.support.design.widget.TextInputLayout
            android:id="@+id/input_layout_name"
            android:layout_width="match_parent"
            android:layout_height="60dp"
            android:layout_marginLeft="45dp"
            android:layout_marginTop="8dp"
            android:layout_toRightOf="@id/symbol"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"

            >

            <EditText
                android:id="@+id/input_name_email"
                android:layout_width="fill_parent"
                android:layout_height="60dp"
                android:textSize="@dimen/textSize"
                android:singleLine="true"
                android:paddingBottom="25dp"
                android:drawableLeft="@drawable/symbol"
                android:background="@android:color/transparent"
                android:windowSoftInputMode="adjustPan|adjustResize"
                android:hint="Email Address"
                android:textColor="#ffffff"
                />
        </android.support.design.widget.TextInputLayout>




    </RelativeLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
    android:layout_width="match_parent"
    android:layout_height="70dp"
    card_view:contentPadding="0dp"
    card_view:cardPreventCornerOverlap="false"
    card_view:cardMaxElevation="3dp"
    card_view:cardUseCompatPadding="true"
    card_view:cardCornerRadius="4dp"
    android:layout_marginLeft="10dp"
    android:layout_marginRight="10dp"
    card_view:cardElevation="4dp"
    card_view:cardBackgroundColor="@color/textViewBackground"
    android:layout_below="@+id/cardView"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true"
    android:layout_marginTop="2dp"
    android:id="@+id/cardView1">
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="60dp">
        <android.support.v7.widget.AppCompatImageView
            android:layout_height="match_parent"
            android:layout_width="wrap_content"
            android:paddingLeft="8dp"
            android:id="@+id/password_icon"
            android:paddingBottom="4dp"
            android:src="@drawable/password_icon"/>

        <android.support.v7.widget.AppCompatImageView
            android:layout_height="match_parent"
            android:layout_width="wrap_content"
            android:paddingLeft="35dp"
            android:paddingBottom="4dp"
            android:src="@drawable/symbol"
            android:id="@+id/symbol2"/>

        <android.support.design.widget.TextInputLayout
            android:id="@+id/input_layout_name2"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="45dp"
            android:layout_marginTop="8dp"
            android:layout_toRightOf="@id/symbol2"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"

            >

            <EditText
                android:id="@+id/input_name_password"
                android:layout_width="fill_parent"
                android:layout_height="60dp"
                android:textSize="@dimen/textSize"
                android:singleLine="true"
                android:paddingBottom="25dp"
                android:drawableLeft="@drawable/symbol"
                android:background="@android:color/transparent"
                android:windowSoftInputMode="adjustPan|adjustResize"
                android:hint="Password"
                android:inputType="textPassword"
                android:textColor="#ffffff"
                android:layout_marginEnd="8dp"
                android:layout_marginRight="8dp" />
        </android.support.design.widget.TextInputLayout>




    </RelativeLayout>
</android.support.v7.widget.CardView>

<android.support.v7.widget.CardView
    android:layout_width="match_parent"
    android:layout_height="70dp"
    card_view:contentPadding="0dp"
    card_view:cardPreventCornerOverlap="false"
    card_view:cardMaxElevation="3dp"
    card_view:cardUseCompatPadding="true"
    card_view:cardCornerRadius="4dp"
    android:layout_marginLeft="10dp"
    android:layout_marginRight="10dp"
    card_view:cardElevation="4dp"
    card_view:cardBackgroundColor="@color/textViewBackground"
    android:layout_below="@+id/cardView1"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true"
    android:layout_marginTop="2dp"
    android:id="@+id/cardView2">
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="60dp">
        <android.support.v7.widget.AppCompatImageView
            android:layout_height="match_parent"
            android:layout_width="wrap_content"
            android:paddingLeft="8dp"
            android:id="@+id/otp_icon"
            android:paddingBottom="4dp"
            android:src="@drawable/confirm_password_icon"/>

        <android.support.v7.widget.AppCompatImageView
            android:layout_height="match_parent"
            android:layout_width="wrap_content"
            android:paddingLeft="35dp"
            android:paddingBottom="4dp"
            android:src="@drawable/symbol"
            android:id="@+id/symbol3"/>

        <android.support.design.widget.TextInputLayout
            android:id="@+id/input_layout_name3"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="45dp"
            android:layout_marginTop="8dp"
            android:layout_toRightOf="@id/symbol3"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"

            >

            <EditText
                android:id="@+id/input_name_confirm_password"
                android:layout_width="fill_parent"
                android:layout_height="60dp"
                android:textSize="@dimen/textSize"
                android:singleLine="true"
                android:paddingBottom="25dp"
                android:drawableLeft="@drawable/symbol"
                android:background="@android:color/transparent"
                android:windowSoftInputMode="adjustPan|adjustResize"
                android:hint="Confirm Password"
                android:inputType="textPassword"
                android:layout_marginEnd="6dp"
                android:textColor="#ffffff"
                android:layout_marginRight="6dp" />

        </android.support.design.widget.TextInputLayout>



    </RelativeLayout>
</android.support.v7.widget.CardView>
<Button

    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_below="@+id/cardView2"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="49dp"
    android:layout_marginLeft="10dp"
    android:layout_marginRight="10dp"
    android:background="@drawable/signup_button"
    android:id="@+id/signup_button" />

enter image description here enter image description here

techDigi
  • 251
  • 3
  • 18

1 Answers1

1

Answer of Question 1:

Yes, you do have to create a different layout for each device screen. Recommended way is create the following folders:

layout for normal mobile devices (6" and below)

layout-sw600dp for 7" Tablets

layout-sw720dp for 8" Tablets and above

The highlighted portion just shows the preview of your layout on different screens under different API levels.

Answer of Question 2:

Yes, you do need all the images. The images will scale as per the device display. The tablets will use xxhdpi and so on. You can however use a single vector graphic, if possible. The Android system will take of the scaling itself.

Answer of Question 3:

Please paste the xml code and screenshots along with the question.

Al-Mothafar
  • 7,949
  • 7
  • 68
  • 102
Suhayl SH
  • 1,213
  • 1
  • 11
  • 16