0

in my application edittextbox not adjustable in small screen and look liek this image from corners https://i.stack.imgur.com/DjZ0T.jpg below is source code how do i set screen adjustable to all sizes??? my code is work fine in normall screen but in small screen UI now fit properly in this iamge which url i post here is my screen edittextbox is not properly fit in screen size please helpme

 <?xml version="1.0" encoding="utf-8"?>




<LinearLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:orientation="vertical"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:background="#D3D3D3"

      >



  <LinearLayout
         android:layout_width="fill_parent"
         android:layout_height="wrap_content"
         android:background="#000000"
         android:orientation="horizontal" >

           <LinearLayout
                android:layout_width="100dip"
                android:layout_height="40dp"
                android:background="#000000"
                android:orientation="vertical" >

                <ImageView
                    android:id="@+id/imageView1"
                    android:layout_width="70dip"
                    android:layout_height="wrap_content"
                    android:layout_gravity="left"
                    android:src="@drawable/logo1" />

        </LinearLayout>


         <LinearLayout
        android:layout_width="wrap_content"
        android:layout_marginLeft="110dp"
        android:layout_height="40dp"
        android:background="#000000"
        android:orientation="vertical" >


            <TextView

        android:layout_width="wrap_content"
        android:layout_height="20dp"            
        android:layout_gravity="right"             
        android:text="My Account"
        android:textColor="#FFCC00" />


   <View
       android:id="@+id/view1"
       android:layout_marginLeft="30dip"    
       android:layout_width="75dip"
       android:layout_gravity="right"
       android:layout_height="1dip"
       android:background="#99CC00" />


           <TextView

        android:layout_width="wrap_content"
        android:layout_height="20dp"           
        android:layout_gravity="right"
        android:textSize="10dip"
        android:text="Balance Inquiry"
        android:textColor="#FFCC00" />        



         </LinearLayout> 

          </LinearLayout>


          <LinearLayout
              android:layout_width="fill_parent"
              android:layout_height="fill_parent"
              android:layout_marginLeft="4dp"
              android:layout_marginTop="15dp"
              android:layout_marginRight="4dp"
              android:background="@drawable/curved2"
              android:orientation="vertical" >

                  <LinearLayout
                      android:layout_width="fill_parent"
                      android:layout_height="wrap_content"
                      android:layout_marginTop="35dip"
                      android:orientation="horizontal" >

                  <TextView
                      android:id="@+id/lblPinno"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:layout_marginLeft="10dp"
                      android:text="Transaction PIN "

                      android:textColor="#FFCC00" />

                  <EditText
                      android:id="@+id/txtPinno"
                      style="?android:attr/buttonStyleSmall"
                      android:layout_width="fill_parent"
                      android:layout_height="wrap_content"
                      android:layout_marginBottom="5dip"
                      android:layout_marginRight="10dp"

                      android:layout_marginTop="2dip"
                      android:inputType="textPassword"
                      android:gravity="left" 
                      android:singleLine="true"
                      />
              </LinearLayout>

              <LinearLayout
                  android:layout_width="fill_parent"
                  android:layout_height="wrap_content"
                  android:layout_marginTop="50dip"
                  android:orientation="horizontal" >

                  <!-- Register Button -->

                  <Button
                      android:id="@+id/btngoback"
                      style="@style/HomeButton"         
                      android:layout_width="70dip"
                      android:layout_height="30dp"              
                      android:layout_marginTop="5dip"
                     android:drawableTop="@drawable/back"


            />

                  <Button
                      android:id="@+id/clearButton"
                      style="?android:attr/buttonStyleSmall"
                      android:layout_width="100dip"
                      android:layout_height="wrap_content"
                      android:layout_marginTop="10dip"
                      android:layout_marginRight="10dip"
                      android:background="@drawable/curved"
                      android:textColor="@drawable/button_text_color"
                      android:text="Clear" />

                  <Button
                       android:id="@+id/btnsubmit"
                       style="?android:attr/buttonStyleSmall"
                       android:layout_width="100dip"
                       android:layout_height="wrap_content"
                       android:layout_marginRight="10dp"
                       android:background="@drawable/curved"
                       android:textColor="@drawable/button_text_color"
                       android:layout_marginTop="10dip"
                       android:text="Submit" />
              </LinearLayout>
          </LinearLayout>

</LinearLayout>
Hayya ANAM
  • 575
  • 2
  • 14
  • 38

2 Answers2

0

You have to create different layouts to handle screen sizes and orientations. Then yo will not face this problem. Please refer link

Community
  • 1
  • 1
kittu88
  • 2,451
  • 5
  • 40
  • 80
0

This is the way if you want the EditText and TextView should get the equal space in the same LinearLayout I am showing the template of this.

 <?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:orientation="horizontal"
    android:weightSum="1" >

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="0.5"
        android:gravity="center"
        android:text="hi" />

    <EditText 
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="0.5"
        android:gravity="center"
        android:text="slgfdsig"
        />

</LinearLayout>

Hope this help you to solve your query.

Narendra Pal
  • 6,474
  • 13
  • 49
  • 85