cant move the text near each other - android

Hello i having some problem design the app I working on
I'm trying to make the TextEdit and The TextView be near each other but they still at the same place
i'm using a grid layout because I want the app be available for all sizes of all the devices
i'm kind of a beginner so I don't understand so much on developing android apps
<GridLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:columnCount="3"
android:rowCount="7">
<TextView
android:id="#+id/WelcomeText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="0"
android:layout_row="0"
android:layout_gravity="left"
android:text="Welcome To My App"
android:textColor="#android:color/background_dark"
/>
<TextView
android:id="#+id/info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="0"
android:layout_row="1"
android:layout_gravity="left"
android:text="Please fill the information"
android:textColor="#android:color/holo_blue_dark"
android:textSize="16sp" />
<TextView
android:id="#+id/nameTxt"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="left"
android:layout_column="0"
android:layout_row="2"
android:text="Name:"
android:textColor="#android:color/black"
android:textSize="16sp"/>
<EditText
android:id="#+id/Name"
style="#style/Widget.AppCompat.EditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:a
android:layout_toEndOf="#id/nameTxt"
android:layout_row="2"
android:layout_column="1"
android:ems="14"
android:capitalize="sentences"
android:inputType="textPersonName"
android:visibility="visible"/>
<TextView
android:id="#+id/phoneTxt"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="left"
android:layout_column="0"
android:layout_row="3"
android:text="Phone:"
android:textColor="#android:color/black"
android:textSize="16sp"/>
<EditText
android:id="#+id/Phone"
style="#style/Widget.AppCompat.EditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="1"
android:layout_row="3"
android:ems="14"
android:inputType="phone"
android:visibility="visible"/>
<TextView
android:id="#+id/emailTxt"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="left"
android:layout_column="0"
android:layout_row="4"
android:text="Email:"
android:textColor="#android:color/black"
android:textSize="16sp"/>
<EditText
android:id="#+id/Email"
style="#style/Widget.AppCompat.EditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="1"
android:layout_row="4"
android:ems="14"
android:inputType="textEmailAddress"
android:visibility="visible"/>
<TextView
android:id="#+id/ageTxt"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="left"
android:layout_column="0"
android:layout_row="5"
android:text="Age:"
android:textColor="#android:color/black"
android:textSize="16sp"/>
<EditText
android:id="#+id/Age"
style="#style/Widget.AppCompat.EditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="1"
android:layout_row="5"
android:ems="14"
android:inputType="number"
android:hint="Age:"
android:visibility="visible"/>
<Button
android:id="#+id/nextBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="0"
android:layout_row="6"
android:text="Next"
android:layout_gravity="center"
android:background="#android:color/holo_blue_dark"
/>
</GridLayout>
how it looks like
the red arrows represent where I want the EditText to be (at the end of each Text View)

You have to bring "info" and "WelcomeText" and "nextBtn" out of "GridLayout", then add LinearLayout:
<LinearLayout
android:layout_width="576dp"
android:layout_height="wrap_content"
android:orientation="vertical"
tools:layout_editor_absoluteY="0dp"
tools:layout_editor_absoluteX="8dp">
<TextView
android:id="#+id/WelcomeText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="0"
android:layout_gravity="left"
android:layout_row="0"
android:text="Welcome To My App"
android:textColor="#android:color/background_dark" />
<TextView
android:id="#+id/info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:text="Please fill the information"
android:textColor="#android:color/holo_blue_dark"
android:textSize="16sp" />
<GridLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:columnCount="3"
android:rowCount="7">
<TextView
android:id="#+id/nameTxt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="0"
android:layout_gravity="left"
android:layout_row="2"
android:text="Name:"
android:textColor="#android:color/black"
android:textSize="16sp" />
<EditText
android:id="#+id/Name"
style="#style/Widget.AppCompat.EditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="1"
android:layout_row="2"
android:layout_toEndOf="#id/nameTxt"
android:a
android:capitalize="sentences"
android:ems="14"
android:inputType="textPersonName"
android:visibility="visible" />
<TextView
android:id="#+id/phoneTxt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="0"
android:layout_gravity="left"
android:layout_row="3"
android:text="Phone:"
android:textColor="#android:color/black"
android:textSize="16sp" />
<EditText
android:id="#+id/Phone"
style="#style/Widget.AppCompat.EditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="1"
android:layout_row="3"
android:ems="14"
android:inputType="phone"
android:visibility="visible" />
<TextView
android:id="#+id/emailTxt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="0"
android:layout_gravity="left"
android:layout_row="4"
android:text="Email:"
android:textColor="#android:color/black"
android:textSize="16sp" />
<EditText
android:id="#+id/Email"
style="#style/Widget.AppCompat.EditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="1"
android:layout_row="4"
android:ems="14"
android:inputType="textEmailAddress"
android:visibility="visible" />
<TextView
android:id="#+id/ageTxt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="0"
android:layout_gravity="left"
android:layout_row="5"
android:text="Age:"
android:textColor="#android:color/black"
android:textSize="16sp" />
<EditText
android:id="#+id/Age"
style="#style/Widget.AppCompat.EditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="1"
android:layout_row="5"
android:ems="14"
android:hint="Age:"
android:inputType="number"
android:visibility="visible" />
</GridLayout>
<Button
android:id="#+id/nextBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="#android:color/holo_blue_dark"
android:text="Next" />
</LinearLayout>

Related

handle views of relative layout on screen rotation

My views get messed up on screen rotation. The data I enter in edit-text does not get erased.
How could I handle my views on screen rotation?
without rotation
with rotation
My code:-
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff"
tools:context="com.example.juhi_gupta.pizza_corner.Home_Delivery_Activity">
<TextView
android:id="#+id/home_page"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="17dp"
android:text="Home Page"
android:textAllCaps="true"
android:textColor="#32127A"
android:textSize="30sp"
android:textStyle="bold|italic" />
<TextView
android:id="#+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="#+id/home_page"
android:layout_marginLeft="26dp"
android:layout_marginStart="26dp"
android:layout_marginTop="33dp"
android:text="Name :"
android:textColor="#0000FF"
android:textSize="14sp"
android:textStyle="bold" />
<EditText
android:id="#+id/editText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/name"
android:layout_alignBottom="#+id/name"
android:layout_alignEnd="#+id/option_3"
android:layout_alignRight="#+id/option_3"
android:layout_marginTop="33dp"
android:ems="10"
android:hint="enter full name"
android:inputType="textCapWords"
android:textColor="#228B22" />
<TextView
android:id="#+id/items"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/name"
android:layout_alignStart="#+id/name"
android:layout_below="#+id/editText"
android:layout_marginTop="33dp"
android:text="#string/delivery_items"
android:textColor="#0000FF"
android:textSize="14sp"
android:textStyle="bold" />
<RadioButton
android:id="#+id/option_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/items"
android:layout_alignRight="#+id/items"
android:layout_below="#+id/items"
android:layout_marginTop="14dp"
android:text="#string/cheeze_burst"
android:textColor="#32127A"
android:textStyle="bold" />
<RadioButton
android:id="#+id/option_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/option_7"
android:layout_marginLeft="15dp"
android:layout_marginTop="-1dp"
android:layout_toRightOf="#+id/mobile"
android:text="#string/mexican_wave"
android:textColor="#32127A"
android:textStyle="bold" />
<RadioButton
android:id="#+id/option_3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/option_2"
android:layout_alignBottom="#+id/option_2"
android:layout_marginStart="12dp"
android:layout_marginLeft="12dp"
android:layout_marginBottom="0dp"
android:layout_toEndOf="#+id/option_2"
android:layout_toRightOf="#+id/option_2"
android:text="#string/extravaganja"
android:textColor="#32127A"
android:textStyle="bold" />
<RadioButton
android:id="#+id/option_4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/option_3"
android:layout_alignLeft="#+id/option_1"
android:layout_marginTop="5dp"
android:text="#string/capsicum_twist"
android:textColor="#32127A"
android:textStyle="bold" />
<RadioButton
android:id="#+id/option_5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/option_4"
android:layout_alignRight="#+id/editText7"
android:layout_marginTop="2dp"
android:layout_marginRight="-12dp"
android:text="#string/choriza_pizza"
android:textColor="#32127A"
android:textStyle="bold" />
<RadioButton
android:id="#+id/option_6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/option_4"
android:layout_marginLeft="24dp"
android:layout_marginTop="-3dp"
android:layout_toRightOf="#+id/mobile"
android:text="#string/golden_corn"
android:textColor="#32127A"
android:textStyle="bold" />
<RadioButton
android:id="#+id/option_7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/rate"
android:layout_alignTop="#+id/items"
android:layout_marginLeft="7dp"
android:layout_marginTop="0dp"
android:text="#string/paneer_crisp"
android:textColor="#32127A"
android:textStyle="bold" />
<RadioButton
android:id="#+id/option_8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/option_7"
android:layout_marginLeft="14dp"
android:layout_marginTop="-1dp"
android:layout_toRightOf="#+id/Sumit"
android:text="#string/pineapple_pizza"
android:textColor="#32127A"
android:textStyle="bold" />
<TextView
android:id="#+id/quantity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginRight="2dp"
android:layout_toLeftOf="#+id/home_page"
android:text="#string/quantity"
android:textColor="#0000FF"
android:textSize="14sp"
android:textStyle="bold" />
<EditText
android:id="#+id/editText2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/quantity"
android:layout_alignBottom="#+id/quantity"
android:layout_alignLeft="#+id/editText"
android:layout_alignStart="#+id/editText"
android:layout_marginLeft="14dp"
android:layout_marginStart="14dp"
android:layout_marginTop="33dp"
android:ems="5"
android:hint="#string/_1_to_1000"
android:inputType="number"
android:textColor="#228B22" />
<TextView
android:id="#+id/address"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/quantity"
android:layout_marginStart="20dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="30dp"
android:layout_marginEnd="2dp"
android:layout_marginRight="2dp"
android:layout_marginBottom="20dp"
android:layout_toStartOf="#+id/home_page"
android:layout_toLeftOf="#+id/home_page"
android:text="#string/address"
android:textColor="#0000FF"
android:textSize="14sp"
android:textStyle="bold" />
<EditText
android:id="#+id/editText3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/address"
android:layout_marginLeft="23dp"
android:layout_marginTop="-10dp"
android:layout_toRightOf="#+id/option_1"
android:ems="10"
android:hint="#string/enter_full_address"
android:textColor="#228B22" />
<TextView
android:id="#+id/mobile"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="#+id/date"
android:layout_alignBottom="#+id/editText4"
android:layout_marginBottom="12dp"
android:text="#string/mobile_number"
android:textColor="#0000FF"
android:textSize="14sp"
android:textStyle="bold" />
<EditText
android:id="#+id/editText4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="#+id/editText3"
android:layout_alignParentBottom="true"
android:layout_marginTop="10dp"
android:layout_marginRight="2dp"
android:layout_marginBottom="171dp"
android:ems="10"
android:hint="#string/_10_digit_mobile_number"
android:inputType="number"
android:textColor="#228B22" />
<TextView
android:id="#+id/date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/name"
android:layout_alignTop="#+id/editText4"
android:layout_marginLeft="2dp"
android:layout_marginTop="54dp"
android:text="#string/delivery_date"
android:textColor="#0000FF"
android:textSize="14sp"
android:textStyle="bold" />
<EditText
android:id="#+id/editText5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignStart="#+id/editText4"
android:layout_alignLeft="#+id/editText4"
android:layout_alignBottom="#+id/date"
android:layout_marginStart="15dp"
android:layout_marginLeft="15dp"
android:layout_marginTop="33dp"
android:layout_marginBottom="-18dp"
android:ems="2"
android:hint="#string/dd"
android:inputType="date"
android:textColor="#228B22" />
<EditText
android:id="#+id/editText7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/editText6"
android:layout_alignBottom="#+id/editText6"
android:layout_marginStart="0dp"
android:layout_marginLeft="0dp"
android:layout_marginBottom="-43dp"
android:layout_toEndOf="#+id/editText2"
android:layout_toRightOf="#+id/editText2"
android:ems="4"
android:hint="#string/yyyy"
android:inputType="date"
android:textColor="#228B22" />
<EditText
android:id="#+id/editText6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/editText5"
android:layout_alignBottom="#+id/editText5"
android:layout_marginEnd="-2dp"
android:layout_marginRight="-2dp"
android:layout_marginBottom="-40dp"
android:layout_toStartOf="#+id/rate"
android:layout_toLeftOf="#+id/rate"
android:ems="2"
android:hint="#string/mm"
android:inputType="date"
android:textColor="#228B22" />
<TextView
android:id="#+id/emailTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/emailText"
android:layout_alignLeft="#+id/quantity"
android:layout_marginLeft="0dp"
android:text="#string/email_id"
android:textColor="#0000FF"
android:textSize="14sp"
android:textStyle="bold" />
<EditText
android:id="#+id/emailText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/editText5"
android:layout_alignRight="#+id/option_5"
android:layout_marginTop="20dp"
android:layout_marginRight="24dp"
android:ems="10"
android:hint="#string/abc_gmail_com"
android:textColor="#228B22" />
<Button
android:id="#+id/Sumit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/Cancel"
android:layout_alignBottom="#+id/Cancel"
android:layout_marginTop="33dp"
android:layout_toLeftOf="#+id/option_2"
android:layout_toStartOf="#+id/option_2"
android:background="#ffff00"
android:onClick="open"
android:text="#string/sumit"
android:textStyle="bold" />
<Button
android:id="#+id/Cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="#+id/option_6"
android:layout_alignParentBottom="true"
android:layout_marginRight="19dp"
android:layout_marginBottom="12dp"
android:background="#ffff00"
android:onClick="reset_all_input_parameters"
android:text="#string/cancel"
android:textStyle="bold" />
<Button
android:id="#+id/rate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/Cancel"
android:layout_alignBottom="#+id/Cancel"
android:layout_marginStart="6dp"
android:layout_marginLeft="6dp"
android:layout_marginTop="33dp"
android:layout_marginBottom="1dp"
android:layout_toEndOf="#+id/option_2"
android:layout_toRightOf="#+id/option_2"
android:background="#ffff00"
android:onClick="rate_page"
android:text="#string/rate_us"
android:textSize="14sp"
android:textStyle="bold" />
</RelativeLayout>
I don't want to fix the orientation of my app. i.e.:-
setRequestedOrientation ( ActivityInfo.SCREEN_ORIENTATION_PORTRAIT ) ; or
android:configChanges= " keyboard|keyboardHidden|orientation"
Only use two layouts for each screen orientation in case you really need a different layout for both cases. I suppose that in your case is much better to have one layout that adjust to both cases.
When working with layout, consider using ConstraintLayout because it adjusts for all screen sizes and cases. Trust me, when I was using RelativeLayout and I was laze to learn about ConstraintLayout, I was being dumb because with ConstraintLayout you will gain a lot of time. Imagine coding one layout that will adjust to more than 20 screens.
For your case, you can use this code:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto">
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#ffffff">
<TextView
android:id="#+id/home_page"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="17dp"
android:text="#string/home_page"
android:textAllCaps="true"
android:textColor="#32127A"
android:textSize="30sp"
android:textStyle="bold|italic"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<TextView
android:id="#+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="20dp"
android:text="Name :"
android:textColor="#0000FF"
android:textSize="14sp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/home_page" />
<EditText
android:id="#+id/editText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="40dp"
android:ems="10"
android:hint="enter full name"
android:inputType="textCapWords"
android:textColor="#228B22"
app:layout_constraintStart_toEndOf="#+id/name"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="#+id/name"
app:layout_constraintBottom_toBottomOf="#+id/name"
app:layout_constraintHorizontal_bias="0.0"/>
<TextView
android:id="#+id/items"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:text="#string/delivery_items"
android:textColor="#0000FF"
android:textSize="14sp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="#+id/name"
app:layout_constraintTop_toBottomOf="#+id/name"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"/>
<LinearLayout
android:id="#+id/radioGroupLinearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:orientation="horizontal"
android:weightSum="2"
app:layout_constraintStart_toStartOf="#+id/items"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="#+id/items"
app:layout_constraintHorizontal_bias="0.0">
<RadioGroup
android:id="#+id/radioGroup1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1">
<RadioButton
android:id="#+id/option_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/cheeze_burst"
android:textColor="#32127A"
android:textStyle="bold" />
<RadioButton
android:id="#+id/option_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/mexican_wave"
android:textColor="#32127A"
android:textStyle="bold" />
<RadioButton
android:id="#+id/option_3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/extravaganja"
android:textColor="#32127A"
android:textStyle="bold" />
<RadioButton
android:id="#+id/option_4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/capsicum_twist"
android:textColor="#32127A"
android:textStyle="bold" />
</RadioGroup>
<RadioGroup
android:id="#+id/radioGroup2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1">
<RadioButton
android:id="#+id/option_5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/choriza_pizza"
android:textColor="#32127A"
android:textStyle="bold" />
<RadioButton
android:id="#+id/option_6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/golden_corn"
android:textColor="#32127A"
android:textStyle="bold" />
<RadioButton
android:id="#+id/option_7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/paneer_crisp"
android:textColor="#32127A"
android:textStyle="bold" />
<RadioButton
android:id="#+id/option_8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/pineapple_pizza"
android:textColor="#32127A"
android:textStyle="bold" />
</RadioGroup>
</LinearLayout>
<TextView
android:id="#+id/quantity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginTop="40dp"
android:layout_marginStart="20dp"
android:text="#string/quantity"
android:textColor="#0000FF"
android:textSize="14sp"
android:textStyle="bold"
app:layout_constraintTop_toBottomOf="#+id/radioGroupLinearLayout"
app:layout_constraintStart_toStartOf="parent"/>
<EditText
android:id="#+id/editText2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="40dp"
android:ems="5"
android:hint="#string/_1_to_1000"
android:inputType="number"
android:textColor="#228B22"
app:layout_constraintStart_toEndOf="#+id/quantity"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="#+id/quantity"
app:layout_constraintBottom_toBottomOf="#+id/quantity"
app:layout_constraintHorizontal_bias="0.0"/>
<TextView
android:id="#+id/address"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/quantity"
android:layout_marginTop="20dp"
android:text="#string/address"
android:textColor="#0000FF"
android:textSize="14sp"
android:textStyle="bold"
app:layout_constraintTop_toBottomOf="#+id/quantity"
app:layout_constraintStart_toStartOf="#+id/quantity" />
<EditText
android:id="#+id/editText3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="40dp"
android:ems="10"
android:hint="#string/enter_full_address"
android:textColor="#228B22"
app:layout_constraintStart_toEndOf="#+id/address"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="#+id/address"
app:layout_constraintBottom_toBottomOf="#+id/address"
app:layout_constraintHorizontal_bias="0.0"/>
<TextView
android:id="#+id/mobile"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:text="#string/mobile_number"
android:textColor="#0000FF"
android:textSize="14sp"
android:textStyle="bold"
app:layout_constraintTop_toBottomOf="#+id/address"
app:layout_constraintStart_toStartOf="#+id/address"/>
<EditText
android:id="#+id/editText4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:ems="10"
android:hint="#string/_10_digit_mobile_number"
android:inputType="number"
android:textColor="#228B22"
app:layout_constraintStart_toEndOf="#+id/mobile"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="#+id/mobile"
app:layout_constraintBottom_toBottomOf="#+id/mobile"
app:layout_constraintHorizontal_bias="0.0"/>
<TextView
android:id="#+id/date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="#string/delivery_date"
android:textColor="#0000FF"
android:textSize="14sp"
android:textStyle="bold"
app:layout_constraintTop_toBottomOf="#+id/mobile"
app:layout_constraintStart_toStartOf="#+id/mobile"/>
<LinearLayout
android:id="#+id/dateLinearLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:orientation="horizontal"
app:layout_constraintStart_toEndOf="#+id/date"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="#+id/date"
app:layout_constraintBottom_toBottomOf="#+id/date"
app:layout_constraintHorizontal_bias="0.0">
<EditText
android:id="#+id/editText5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="2"
android:hint="#string/dd"
android:inputType="date"
android:textColor="#228B22" />
<EditText
android:id="#+id/editText7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="4"
android:hint="#string/yyyy"
android:inputType="date"
android:textColor="#228B22" />
<EditText
android:id="#+id/editText6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="2"
android:hint="#string/mm"
android:inputType="date"
android:textColor="#228B22" />
</LinearLayout>
<TextView
android:id="#+id/emailTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="#string/email_id"
android:textColor="#0000FF"
android:textSize="14sp"
android:textStyle="bold"
app:layout_constraintTop_toBottomOf="#+id/date"
app:layout_constraintStart_toStartOf="#+id/date"/>
<EditText
android:id="#+id/emailText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:ems="10"
android:hint="#string/abc_gmail_com"
android:textColor="#228B22"
app:layout_constraintStart_toEndOf="#+id/emailTextView"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="#+id/emailTextView"
app:layout_constraintBottom_toBottomOf="#+id/emailTextView"
app:layout_constraintHorizontal_bias="0.0"/>
<Button
android:id="#+id/Sumit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:background="#ffff00"
android:onClick="open"
android:text="#string/sumit"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="#+id/Cancel"
app:layout_constraintTop_toBottomOf="#+id/emailTextView"
app:layout_constraintBottom_toBottomOf="parent"/>
<Button
android:id="#+id/Cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#ffff00"
android:onClick="reset_all_input_parameters"
android:text="#string/cancel"
android:textStyle="bold"
app:layout_constraintStart_toEndOf="#+id/Sumit"
app:layout_constraintTop_toTopOf="#+id/Sumit"
app:layout_constraintBottom_toBottomOf="#+id/Sumit"
app:layout_constraintEnd_toStartOf="#+id/rate"/>
<Button
android:id="#+id/rate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#ffff00"
android:onClick="rate_page"
android:text="#string/rate_us"
android:textSize="14sp"
android:textStyle="bold"
app:layout_constraintStart_toEndOf="#+id/Cancel"
app:layout_constraintTop_toTopOf="#+id/Cancel"
app:layout_constraintBottom_toBottomOf="#+id/Cancel"
app:layout_constraintEnd_toEndOf="parent"/>
</android.support.constraint.ConstraintLayout>
</ScrollView>
You can create another view for the same page in the editor. In the upper settings, choose orientation and create one for horizontal orientation. Set everything as you wish and you app will use the version you created when the orientation changes.
In orientation changes everything is rendered again in Android. However, as far as I know, you should now lose the EditText entries. If your TextViews are also set correctly in vertical mode, after setting up horizontal mode, they should also appear as expected.
A simple way to obtain a landscape layout is creating a layout-land resource directory folder.
Right click on
Res folder >> New >> AndroidResoursceDirectory
A dialogue box appears in that select Resource type as layout from the drop-down and select orientation from qualifiers and add landscape and click ok. Hence a folder will create under the res folder "layout-land".
Copy your current layout and paste in the layout-land folder and then edit your layout as per how you want to display it while orientation changes to the landscape mode.
By this method when you shift your app orientation from portrait to landscape you can create the same view designed for landscape mode.

How to make this android layout more 'responsive'?

I have an android layout with some title bar and some input fields, and when I try to input some values, I can do it, but
the title bar vanishes
If I want to edit the field "Another number" I cannot scroll down to use the SeekBar instead.
How can I change the layout to make it
Have the title bar (with the text "InputExample") always fixes
Have the other content of the screen scrollable (so that I can use the SeekBar, for example)?
The layout is here:
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:fitsSystemWindows="true"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#cccccc"
android:layout_marginBottom = "0dp">
<GridLayout
android:id="#+id/grid"
android:layout_margin="30dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_above="#+id/new_cancel"
android:alignmentMode="alignBounds"
android:columnCount="10"
android:columnOrderPreserved="false"
android:useDefaultMargins="true">
<TextView
android:id="#+id/textTitleEdit"
android:layout_column="0"
android:layout_columnSpan="10"
android:layout_gravity="center_horizontal"
android:layout_row="0"
android:text="My Title"
android:textSize="32dip"/>
<TextView
android:text="You can enter some values"
android:textSize="16dip"
android:layout_columnSpan="8"
android:layout_gravity="left"
android:id="#+id/textSubTitleEdit"
android:layout_row="1"
android:layout_column="0" />
<TextView
android:text="Name"
android:layout_gravity="right"
android:layout_row="2"
android:layout_column="0"
/>
<EditText
android:ems="7"
android:singleLine="true"
android:inputType="textCapWords"
android:id="#+id/new_name"
android:layout_row="2"
android:layout_column="1" />
_____________
<TextView
android:text="Label"
android:layout_gravity="right"
android:layout_row="3"
android:layout_column="0" />
<EditText
android:ems="7"
android:singleLine="true"
android:inputType="textCapWords"
android:id="#+id/new_label"
android:layout_row="3"
android:layout_column="1" />
______
<TextView
android:layout_column="0"
android:text="Put in a number"
android:layout_gravity="right"
/>
<EditText
android:ems="7"
android:singleLine="true"
android:id="#+id/new_price"
android:inputType="numberDecimal"
android:layout_row="4"
android:layout_column="1" />
<TextView
android:layout_column="0"
android:text="Another number"
android:layout_gravity="right"
android:layout_row="5" />
<EditText
android:ems="7"
android:singleLine="true"
android:id="#+id/new_offset"
android:inputType="number"
android:layout_row="5"
android:layout_column="1" />
<SeekBar
android:id="#+id/seek_offset"
style="#android:style/Widget.Holo.SeekBar"
android:layout_width="150dp"
android:layout_column="1"
android:layout_row="6"
android:max="20"/>
<TextView
android:text="Comment"
android:layout_gravity="right"
android:layout_row="7"
android:layout_column="0" />
<EditText
android:ems="7"
android:singleLine="true"
android:inputType="textCapWords"
android:id="#+id/new_comment"
android:layout_row="7"
android:layout_column="1" />
</GridLayout>
<Button
android:id="#+id/new_cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:background="#aaaaaa"
android:text="Cancel"
android:layout_margin="5dp"
/>
<Button
android:id="#+id/new_ok"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:background="#dddddd"
android:text="Ok"
android:layout_margin="5dp"
/>
</RelativeLayout>
</FrameLayout>
Was having some problems with your original layout so I've fixed it up and I think this solution should work. Everything in the preview of the layout has it positioned correctly so hopefully when you use this in the emulator it should work.
I personally prefer using LinearLayouts with weights for the majority of my layouts, I know some others prefer RelativeLayouts.
Essentially you should look to contain the part which you wish to scroll with a layout of some kind and then the ScrollView contains this layout so it can be scrolled. This is why I've removed the title and subtitle from the GridLayout.
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:fitsSystemWindows="true"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#cccccc"
android:weightSum="6">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="2.5"
android:orientation="vertical"
android:gravity="bottom|center_horizontal">
<TextView
android:id="#+id/textTitleEdit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="My Title"
android:textSize="32dip"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="You can enter some values"
android:textSize="16dip"
android:layout_gravity="center_horizontal"
android:id="#+id/textSubTitleEdit"/>
</LinearLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<GridLayout
android:id="#+id/grid"
android:layout_margin="30dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alignmentMode="alignBounds"
android:columnCount="10"
android:columnOrderPreserved="false"
android:useDefaultMargins="true">
<TextView
android:text="Name"
android:layout_gravity="right"
android:layout_row="2"
android:layout_column="0"/>
<EditText
android:ems="7"
android:singleLine="true"
android:inputType="textCapWords"
android:id="#+id/new_name"
android:layout_row="2"
android:layout_column="1"/>
<TextView
android:text="Label"
android:layout_gravity="right"
android:layout_row="3"
android:layout_column="0"/>
<EditText
android:ems="7"
android:singleLine="true"
android:inputType="textCapWords"
android:id="#+id/new_label"
android:layout_row="3"
android:layout_column="1" />
<TextView
android:layout_column="0"
android:text="Put in a number"
android:layout_gravity="right"
/>
<EditText
android:ems="7"
android:singleLine="true"
android:id="#+id/new_price"
android:inputType="numberDecimal"
android:layout_row="4"
android:layout_column="1" />
<TextView
android:layout_column="0"
android:text="Another number"
android:layout_gravity="end"
android:layout_row="5" />
<EditText
android:ems="7"
android:singleLine="true"
android:id="#+id/new_offset"
android:inputType="number"
android:layout_row="5"
android:layout_column="1" />
<SeekBar
android:id="#+id/seek_offset"
style="#android:style/Widget.Holo.SeekBar"
android:layout_width="150dp"
android:layout_column="1"
android:layout_row="6"
android:max="20"/>
<TextView
android:text="Comment"
android:layout_gravity="right"
android:layout_row="7"
android:layout_column="0" />
<EditText
android:ems="7"
android:singleLine="true"
android:inputType="textCapWords"
android:id="#+id/new_comment"
android:layout_row="7"
android:layout_column="1" />
</GridLayout>
</ScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="2.5"
android:gravity="bottom|center_horizontal"
android:weightSum="2">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="start"
android:layout_weight="1">
<Button
android:id="#+id/new_cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity=""
android:background="#aaaaaa"
android:text="Cancel"
android:layout_margin="5dp"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="end"
android:layout_weight="1">
<Button
android:id="#+id/new_ok"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#dddddd"
android:text="Ok"
android:layout_margin="5dp"/>
</RelativeLayout>
</LinearLayout>

Grid layout has space on last column

I have set up a grid layout with 6 columns and there is a space between column 5 and 6. The grid contains image buttons all with the same size. I have tried to use fill_parent and wrap_content but the gap still shows. I have also tried layout gravity=1 without results.
button image dimensions 104 x 104 pixels
The device is Samsung tab A
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
tools:context=".Main">
<GridLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:id="#+id/grid"
android:columnCount="6"
>
<TextView
android:layout_width="175dp"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="MASTER 100"
android:id="#+id/textView_master"
android:layout_row="0"
android:layout_column="0"
android:layout_columnSpan="2"
android:layout_gravity="center_horizontal"
android:textColor="#ffffff"
android:textSize="20sp"
android:gravity="center_horizontal"/>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/masterup"
android:layout_row="1"
android:layout_column="0"
android:background="#drawable/masterup"
android:layout_margin="#dimen/button_margin"
/>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/masterdn"
android:layout_row="1"
android:layout_column="1"
android:background="#drawable/masterdn"
android:layout_margin="#dimen/button_margin"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="117dp"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="100"
android:id="#+id/tv_RGBAW_Value"
android:layout_row="1"
android:layout_column="2"
android:layout_columnSpan="3"
android:textSize="100dp"
android:textIsSelectable="true"
android:textColor="#0aff1f"
android:paddingTop="10dp"
android:layout_gravity="center_horizontal"
/>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/blackout"
android:layout_row="1"
android:layout_column="5"
android:background="#drawable/blackout"
android:layout_margin="#dimen/button_margin"
/>
<TextView
android:layout_width="565dp"
android:layout_height="45dp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Fixture"
android:id="#+id/tv_fixture_data"
android:layout_row="3"
android:layout_column="0"
android:layout_columnSpan="6"
android:textSize="30sp"
android:textIsSelectable="false"
android:paddingLeft="15dp"
android:paddingTop="5dp"
android:linksClickable="true"
android:singleLine="true"
android:background="#d8ffba"
android:textColor="#120dff"
/>
<Space
android:layout_width="20px"
android:layout_height="20px"
android:layout_row="4"
android:layout_column="0"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="100"
android:id="#+id/textViewred"
android:layout_row="5"
android:layout_column="0"
android:layout_gravity="center_horizontal"
android:textSize="20sp"
android:textColor="#0fff33"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="100"
android:id="#+id/textViewgreen"
android:layout_row="5"
android:layout_column="1"
android:layout_gravity="center_horizontal"
android:textSize="20sp"
android:textColor="#0fff33"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="100"
android:id="#+id/textViewblue"
android:layout_row="5"
android:layout_column="2"
android:layout_gravity="center_horizontal"
android:textSize="20sp"
android:textColor="#0fff33"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="100"
android:id="#+id/textViewamber"
android:layout_row="5"
android:layout_column="3"
android:layout_gravity="center_horizontal"
android:textSize="20sp"
android:textColor="#0fff33"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="100"
android:id="#+id/textViewwhite"
android:layout_row="5"
android:layout_column="4"
android:textSize="20sp"
android:layout_gravity="center_horizontal"
android:textColor="#0fff33"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="SLOW"
android:id="#+id/tv_speed"
android:layout_row="5"
android:layout_column="5"
android:layout_gravity="center_horizontal"
android:textColor="#ffffff"
android:textSize="20sp"/>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/redup"
android:layout_row="7"
android:layout_column="0"
android:background="#drawable/redup"
android:layout_margin="#dimen/button_margin"
/>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/greenup"
android:layout_row="7"
android:layout_column="1"
android:background="#drawable/greenup"
android:layout_margin="#dimen/button_margin"
/>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/blueup"
android:layout_row="7"
android:layout_column="2"
android:background="#drawable/blueup"
android:layout_margin="#dimen/button_margin"
/>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/amberup"
android:layout_row="7"
android:layout_column="3"
android:background="#drawable/amberup"
android:layout_margin="#dimen/button_margin"
/>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/whiteup"
android:layout_row="7"
android:layout_column="4"
android:background="#drawable/whiteup"
android:layout_margin="#dimen/button_margin"
/>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/speed"
android:layout_row="7"
android:layout_column="5"
android:background="#drawable/speed"
android:layout_margin="#dimen/button_margin"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="RED"
android:id="#+id/red_active"
android:layout_row="8"
android:layout_column="0"
android:gravity="center"
android:textAlignment="center"
android:layout_gravity="center_horizontal"
android:textColor="#fdffff"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="GREEN"
android:id="#+id/green_active"
android:layout_row="8"
android:layout_column="1"
android:layout_gravity="center_horizontal"
android:textColor="#ffffff"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="BLUE"
android:id="#+id/blue_Active"
android:layout_row="8"
android:layout_column="2"
android:layout_gravity="center_horizontal"
android:textColor="#ffffff"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="AMBER"
android:id="#+id/amber_active"
android:layout_row="8"
android:layout_column="3"
android:layout_gravity="center_horizontal"
android:textColor="#ffffff"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="WHITE"
android:id="#+id/white_active"
android:layout_row="8"
android:layout_column="4"
android:layout_gravity="center_horizontal"
android:textColor="#ffffff"/>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/reddn"
android:layout_row="9"
android:layout_column="0"
android:background="#drawable/reddn"
android:layout_margin="#dimen/button_margin"
/>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/greendn"
android:layout_row="9"
android:layout_column="1"
android:background="#drawable/greendn"
android:layout_margin="#dimen/button_margin"
/>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/bluedn"
android:layout_row="9"
android:layout_column="2"
android:background="#drawable/bluedn"
android:layout_margin="#dimen/button_margin"
/>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/amberdn"
android:layout_row="9"
android:layout_column="3"
android:background="#drawable/amberdn"
android:layout_margin="#dimen/button_margin"
/>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/whitedn"
android:layout_row="9"
android:layout_column="4"
android:background="#drawable/whitedn"
android:layout_margin="#dimen/button_margin"
/>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/full"
android:layout_row="9"
android:layout_column="5"
android:background="#drawable/full"
android:layout_margin="#dimen/button_margin"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="FIXTURES"
android:id="#+id/tv_fixturestatus"
android:layout_row="10"
android:layout_column="0"
android:layout_gravity="center_horizontal"
android:textColor="#ffffff"/>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/q1"
android:layout_row="11"
android:layout_column="0"
android:background="#drawable/q1_buttons"
android:layout_margin="#dimen/button_margin"
/>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/q2"
android:layout_row="11"
android:layout_column="1"
android:background="#drawable/q2_buttons"
android:layout_margin="#dimen/button_margin"
/>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/q3"
android:layout_row="11"
android:layout_column="2"
android:background="#drawable/q3_buttons"
android:layout_margin="#dimen/button_margin"
/>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/q4"
android:layout_row="11"
android:layout_column="3"
android:background="#drawable/q4_buttons"
android:layout_margin="#dimen/button_margin"
/>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/play"
android:layout_row="11"
android:layout_column="4"
android:background="#drawable/play_button"
android:layout_margin="#dimen/button_margin"
/>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/record"
android:layout_row="11"
android:layout_column="5"
android:background="#drawable/rec"
android:layout_margin="#dimen/button_margin"
/>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/q5"
android:layout_row="12"
android:layout_column="0"
android:background="#drawable/q5_buttons"
android:layout_margin="#dimen/button_margin"
/>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/q6"
android:layout_row="12"
android:layout_column="1"
android:background="#drawable/q6_buttons"
android:layout_margin="#dimen/button_margin"
/>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/q7"
android:layout_row="12"
android:layout_column="2"
android:background="#drawable/q7_buttons"
android:layout_margin="#dimen/button_margin"
/>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/q8"
android:layout_row="12"
android:layout_column="3"
android:background="#drawable/q8_buttons"
android:layout_margin="#dimen/button_margin"
/>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/group"
android:layout_row="12"
android:layout_column="4"
android:background="#drawable/go"
android:layout_margin="#dimen/button_margin"
/>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/all"
android:layout_row="12"
android:layout_column="5"
android:background="#drawable/all"
android:layout_margin="#dimen/button_margin"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="COLOR ROLL"
android:id="#+id/textView2"
android:layout_row="13"
android:layout_column="0"
android:layout_gravity="center_horizontal"
android:textColor="#ffffff"/>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/cr1"
android:layout_row="14"
android:layout_column="0"
android:background="#drawable/rc1"
android:layout_margin="#dimen/button_margin"
/>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/cr2"
android:layout_row="14"
android:layout_column="1"
android:background="#drawable/cr2"
android:layout_margin="#dimen/button_margin"
/>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/cr3"
android:layout_row="14"
android:layout_column="2"
android:background="#drawable/cr3"
android:layout_margin="#dimen/button_margin"
/>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/cr_stop"
android:layout_row="14"
android:layout_column="3"
android:background="#drawable/cr_stop"
android:layout_margin="#dimen/button_margin"
/>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/shift"
android:layout_row="14"
android:layout_column="5"
android:background="#drawable/shift"
android:layout_margin="#dimen/button_margin"
/>
<Space
android:layout_width="20px"
android:layout_height="190px"
android:layout_row="15"
android:layout_column="0"/>
</GridLayout>
I use an button margin
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
<dimen name="button_margin">5dp</dimen>
<dimen name="image_button_height">85dp</dimen>
<dimen name="image_button_width">85dp</dimen>

Gridlayout widget out of screen Android

The GridView I made results in the following layout:
How to set up the layout to avoid the out of screen widgets?
The Grid Layout itself is ok and filling the screen but the children do not and overlapp.
here the XML of the gridlayout:
<GridLayout
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:columnCount="4"
android:rowCount="3">
<ImageButton
android:id="#+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/circular"
android:layout_row="0"
android:layout_column="3"
android:layout_rowSpan="3" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:id="#+id/textView4"
android:layout_row="1"
android:layout_column="0" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="numberDecimal"
android:ems="10"
android:id="#+id/editText"
android:layout_row="1"
android:layout_column="1" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:id="#+id/textView5"
android:layout_row="1"
android:layout_column="2" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:id="#+id/textView10"
android:layout_row="2"
android:layout_column="0" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="numberDecimal"
android:ems="10"
android:id="#+id/editText2"
android:layout_row="2"
android:layout_column="1" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:id="#+id/textView11"
android:layout_row="2"
android:layout_column="2" />
</GridLayout>

android grid layout allignment

at the moment i'm building schedule view and i have one problem. how to make grid layout take all the screen space equally?
as you can see (column), friday takes up all the space that's left. same with hours (rows), if the screen is bigger, last one will takes all the space. (damn, cannot upload pictures, because i dont have enough rep)
<?xml version="1.0" encoding="utf-8"?>
<TextView android:text="FONTYS LOGO"
android:layout_width="wrap_content"
android:layout_height="70dp"
android:layout_gravity="left"
android:id="#+id/textView"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />
<GridLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:rowCount="12"
android:columnCount="15"
android:layout_below="#+id/textView"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:layout_row="0"
android:layout_column="0"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="1"
android:layout_gravity="center"
android:id="#+id/firstLessonTextView"
android:layout_row="0"
android:layout_column="1" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="2"
android:layout_gravity="center"
android:id="#+id/textView3"
android:layout_row="0"
android:layout_column="2" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="3"
android:layout_gravity="center"
android:id="#+id/textView4"
android:layout_row="0"
android:layout_column="3" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="4"
android:layout_gravity="center"
android:id="#+id/textView5"
android:layout_row="0"
android:layout_column="4" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="5"
android:layout_gravity="center"
android:id="#+id/textView6"
android:layout_row="0"
android:layout_column="5" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="6"
android:layout_gravity="center"
android:id="#+id/textView7"
android:layout_row="0"
android:layout_column="6" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="7"
android:layout_gravity="center"
android:id="#+id/textView8"
android:layout_row="0"
android:layout_column="7" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="8"
android:layout_gravity="center"
android:id="#+id/textView9"
android:layout_row="0"
android:layout_column="8" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="9"
android:layout_gravity="center"
android:id="#+id/textView10"
android:layout_row="0"
android:layout_column="9" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="10"
android:layout_gravity="center"
android:id="#+id/textView11"
android:layout_row="0"
android:layout_column="10" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="11"
android:layout_gravity="center"
android:id="#+id/textView12"
android:layout_row="0"
android:layout_column="11" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="12"
android:layout_gravity="center"
android:id="#+id/textView13"
android:layout_row="0"
android:layout_column="12" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="13"
android:layout_gravity="center"
android:id="#+id/textView14"
android:layout_row="0"
android:layout_column="13" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="08.45"
android:id="#+id/firstLessonTimeTextView"
android:layout_row="1"
android:layout_column="1" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="09.35"
android:paddingLeft="3dp"
android:id="#+id/textView15"
android:layout_row="1"
android:layout_column="2" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="10.45"
android:paddingLeft="3dp"
android:id="#+id/textView16"
android:layout_row="1"
android:layout_column="3" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="11.35"
android:paddingLeft="3dp"
android:id="#+id/textView17"
android:layout_row="1"
android:layout_column="4" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="12.25"
android:paddingLeft="3dp"
android:id="#+id/textView18"
android:layout_row="1"
android:layout_column="5" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="13.15"
android:paddingLeft="3dp"
android:id="#+id/textView19"
android:layout_row="1"
android:layout_column="6" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="14.05"
android:paddingLeft="3dp"
android:id="#+id/textView20"
android:layout_row="1"
android:layout_column="7" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="15.15"
android:paddingLeft="3dp"
android:id="#+id/textView21"
android:layout_row="1"
android:layout_column="8" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="16.05"
android:paddingLeft="3dp"
android:id="#+id/textView22"
android:layout_row="1"
android:layout_column="9" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="16.55"
android:paddingLeft="3dp"
android:id="#+id/textView23"
android:layout_row="1"
android:layout_column="10" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="18.00"
android:paddingLeft="3dp"
android:id="#+id/textView24"
android:layout_row="1"
android:layout_column="11" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="18.50"
android:paddingLeft="3dp"
android:id="#+id/textView25"
android:layout_row="1"
android:layout_column="12" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="20.00"
android:paddingLeft="3dp"
android:id="#+id/textView26"
android:layout_row="1"
android:layout_column="13" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Mon"
android:textSize="13sp"
android:layout_gravity="center"
android:layout_row="2"
android:layout_column="0" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:id="#+id/gradesDateMondayID"
android:textSize="13sp"
android:layout_row="3"
android:layout_column="0"
android:layout_gravity="center"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Tue"
android:textSize="13sp"
android:layout_gravity="center"
android:layout_row="4"
android:layout_column="0"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:text=""
android:layout_row="5"
android:layout_column="0"
android:id="#+id/gradesDateTuesdayID"
android:textSize="13sp"
android:layout_gravity="center"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Wed"
android:textSize="13sp"
android:layout_gravity="center"
android:layout_row="6"
android:layout_column="0" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:layout_marginLeft="3dp"
android:id="#+id/gradesDateWednesdayID"
android:textSize="13sp"
android:layout_row="7"
android:layout_column="0"
android:layout_gravity="center"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Thu"
android:textSize="13sp"
android:layout_gravity="center"
android:layout_row="8"
android:layout_column="0" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:layout_marginLeft="3dp"
android:layout_gravity="center"
android:id="#+id/gradesDateThursdayID"
android:textSize="13sp"
android:layout_row="9"
android:layout_column="0" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Fri"
android:textSize="13sp"
android:layout_gravity="center"
android:layout_row="10"
android:layout_column="0" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:layout_marginLeft="3dp"
android:id="#+id/gradesDateFridayID"
android:textSize="13sp"
android:layout_row="11"
android:layout_column="0"
android:layout_gravity="center"/>
</GridLayout>
parameters on all textviews are the same. all 15colums and 12 rows are used. hope you can help me
the solution is :
in your layout , you should declare :
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<GridView
android:id="#+id/fragment_dandan_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:numColumns="3"
android:paddingTop="10dp"
android:listSelector="#0099f1"
android:divider="#drawable/parand_line_divider"
android:dividerHeight="1dp"
android:footerDividersEnabled="false"
android:headerDividersEnabled="false" />
</RelativeLayout>
i praper some tutorial for you , that be useful :
AndroidHive Tutorial
Mkyong Tutorial , That be Very Clear
update
you need something like this :

Categories

Resources