I would like to change my view visibility using Contarint sets, I create two identical views but in second view I make my view visibility gone, actually when I run my activity it only shows the second XML where view visibility has already gone but no animation how its visibility has gone.
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/constraint"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/white">
<LinearLayout
android:id="#+id/socialPart"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="visible"
android:orientation="vertical"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="#+id/appName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="#font/poppins_bold"
android:gravity="center"
android:text="#string/app_name_title"
android:textColor="#color/blue"
android:textSize="40sp" />
<LinearLayout
android:id="#+id/toolBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="15dp"
android:layout_marginEnd="20dp"
android:orientation="horizontal">
<ImageView
android:id="#+id/back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="#drawable/ic_arrow_left" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="#font/poppins_bold"
android:gravity="center"
android:text="#string/create_account"
android:textColor="#color/title_color"
android:textSize="25sp" />
</LinearLayout>
<Button
android:id="#+id/facebook"
style="#style/button_main"
android:layout_marginTop="20dp"
android:background="#drawable/strock_rounded_button"
android:drawableStart="#drawable/ic_facebook"
android:drawablePadding="20dp"
android:gravity="start|center_vertical"
android:paddingStart="20dp"
android:paddingEnd="0dp"
android:text="#string/continue_facebook"
android:textColor="#color/gray"
android:textSize="20sp" />
<Button
android:id="#+id/google"
style="#style/button_main"
android:layout_marginTop="15dp"
android:background="#drawable/strock_rounded_button"
android:drawableStart="#drawable/ic_google"
android:drawablePadding="20dp"
android:gravity="start|center_vertical"
android:paddingStart="20dp"
android:paddingEnd="0dp"
android:text="#string/continue_google"
android:textColor="#color/gray"
android:textSize="20sp" />
<LinearLayout
android:id="#+id/useEmail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="20dp"
android:gravity="center"
android:orientation="horizontal"
android:weightSum="1">
<View
android:layout_width="0dp"
android:layout_height="3dp"
android:layout_weight="0.3"
android:background="#DADADA" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:layout_weight="0.4"
android:fontFamily="#font/poppins_medium"
android:gravity="center"
android:text="#string/use_register_email" />
<View
android:layout_width="0dp"
android:layout_height="3dp"
android:layout_weight="0.3"
android:background="#DADADA" />
</LinearLayout>
</LinearLayout>
<EditText
android:id="#+id/email"
android:layout_width="match_parent"
android:layout_height="#dimen/main_button_size"
android:layout_marginStart="20dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="20dp"
android:background="#drawable/strock_rounded_button"
android:drawableStart="#drawable/ic_mail"
android:drawablePadding="10dp"
android:hint="#string/hint_email"
android:paddingStart="20dp"
android:paddingEnd="0dp"
app:layout_constraintTop_toBottomOf="#id/socialPart" />
<EditText
android:id="#+id/password"
android:layout_width="match_parent"
android:layout_height="#dimen/main_button_size"
android:layout_marginStart="20dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="20dp"
android:background="#drawable/strock_rounded_button"
android:drawableStart="#drawable/ic_lock"
android:drawablePadding="10dp"
android:hint="#string/hint_password"
android:inputType="textPassword"
android:paddingStart="20dp"
android:paddingEnd="0dp"
app:layout_constraintTop_toBottomOf="#+id/email" />
<EditText
android:id="#+id/confirmPass"
android:layout_width="match_parent"
android:layout_height="#dimen/main_button_size"
android:layout_marginStart="20dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="20dp"
android:background="#drawable/strock_rounded_button"
android:drawableStart="#drawable/ic_lock"
android:drawablePadding="10dp"
android:hint="#string/hint_confirm_pass"
android:inputType="textPassword"
android:paddingStart="20dp"
android:paddingEnd="0dp"
app:layout_constraintTop_toBottomOf="#+id/password" />
<TextView
android:id="#+id/termAndServices"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="20dp"
android:drawablePadding="10dp"
android:fontFamily="#font/poppins_medium"
android:text="#string/term_and_condition"
android:textColor="#4D4D4D"
app:layout_constraintTop_toBottomOf="#+id/confirmPass" />
<Button
android:id="#+id/login"
style="#style/button_main"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:layout_marginBottom="30dp"
android:backgroundTint="#color/gray"
android:text="#string/get_started"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
my main layout where socialPart is Visible
androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/white">
<LinearLayout
android:id="#+id/socialPart"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="#+id/appName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="#font/poppins_bold"
android:gravity="center"
android:text="#string/app_name_title"
android:textColor="#color/blue"
android:textSize="40sp" />
<LinearLayout
android:id="#+id/toolBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="15dp"
android:layout_marginEnd="20dp"
android:orientation="horizontal">
<ImageView
android:id="#+id/back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="#drawable/ic_arrow_left" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="#font/poppins_bold"
android:gravity="center"
android:text="#string/create_account"
android:textColor="#color/title_color"
android:textSize="25sp" />
</LinearLayout>
<Button
android:id="#+id/facebook"
style="#style/button_main"
android:layout_marginTop="20dp"
android:background="#drawable/strock_rounded_button"
android:drawableStart="#drawable/ic_facebook"
android:drawablePadding="20dp"
android:gravity="start|center_vertical"
android:paddingStart="20dp"
android:paddingEnd="0dp"
android:text="#string/continue_facebook"
android:textColor="#color/gray"
android:textSize="20sp" />
<Button
android:id="#+id/google"
style="#style/button_main"
android:layout_marginTop="15dp"
android:background="#drawable/strock_rounded_button"
android:drawableStart="#drawable/ic_google"
android:drawablePadding="20dp"
android:gravity="start|center_vertical"
android:paddingStart="20dp"
android:paddingEnd="0dp"
android:text="#string/continue_google"
android:textColor="#color/gray"
android:textSize="20sp" />
<LinearLayout
android:id="#+id/useEmail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="20dp"
android:gravity="center"
android:orientation="horizontal"
android:weightSum="1">
<View
android:layout_width="0dp"
android:layout_height="3dp"
android:layout_weight="0.3"
android:background="#DADADA" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:layout_weight="0.4"
android:fontFamily="#font/poppins_medium"
android:gravity="center"
android:text="#string/use_register_email" />
<View
android:layout_width="0dp"
android:layout_height="3dp"
android:layout_weight="0.3"
android:background="#DADADA" />
</LinearLayout>
</LinearLayout>
<EditText
android:id="#+id/email"
android:layout_width="match_parent"
android:layout_height="#dimen/main_button_size"
android:layout_marginStart="20dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="20dp"
android:background="#drawable/strock_rounded_button"
android:drawableStart="#drawable/ic_mail"
android:drawablePadding="10dp"
android:hint="#string/hint_email"
android:paddingStart="20dp"
android:paddingEnd="0dp"
app:layout_constraintTop_toBottomOf="#id/socialPart" />
<EditText
android:id="#+id/password"
android:layout_width="match_parent"
android:layout_height="#dimen/main_button_size"
android:layout_marginStart="20dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="20dp"
android:background="#drawable/strock_rounded_button"
android:drawableStart="#drawable/ic_lock"
android:drawablePadding="10dp"
android:hint="#string/hint_password"
android:inputType="textPassword"
android:paddingStart="20dp"
android:paddingEnd="0dp"
app:layout_constraintTop_toBottomOf="#+id/email" />
<EditText
android:id="#+id/confirmPass"
android:layout_width="match_parent"
android:layout_height="#dimen/main_button_size"
android:layout_marginStart="20dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="20dp"
android:background="#drawable/strock_rounded_button"
android:drawableStart="#drawable/ic_lock"
android:drawablePadding="10dp"
android:hint="#string/hint_confirm_pass"
android:inputType="textPassword"
android:paddingStart="20dp"
android:paddingEnd="0dp"
app:layout_constraintTop_toBottomOf="#+id/password" />
<TextView
android:id="#+id/termAndServices"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="20dp"
android:drawablePadding="10dp"
android:fontFamily="#font/poppins_medium"
android:text="#string/term_and_condition"
android:textColor="#4D4D4D"
app:layout_constraintTop_toBottomOf="#+id/confirmPass" />
<Button
android:id="#+id/login"
style="#style/button_main"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:layout_marginBottom="30dp"
android:backgroundTint="#color/gray"
android:text="#string/get_started"
app:layout_constraintBottom_toBottomOf="parent" />
what I want to have in the end, but when I run my application it shows the second view where visibility is already gone and there is no any animation
Related
I have a screen with four EditTexts, any edittext doesn't open the keyboard when I click on it. I'm not using an AVD, I'm using my own device, and tested in others devices and same result.My app has some activities like Login , sigup, home activity. In login and sigup activity edittext works correctly but in fragments of home activity keyboard is not opening.
XML
```
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="100dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="210dp"
android:background="#color/global_bg"
android:padding="20dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="18dp">
<de.hdodenhof.circleimageview.CircleImageView
android:id="#+id/profile_image"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_centerVertical="true"
android:src="#drawable/profile"
app:civ_border_color="#color/main_color"
app:civ_border_width="5dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="10dp"
android:layout_toEndOf="#+id/profile_image"
android:orientation="vertical">
<TextView
android:id="#+id/fullname_field"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="#font/bungee"
android:includeFontPadding="false"
android:text="Muneeb Ur Rehman"
android:textColor="#color/black"
android:textSize="19sp" />
<TextView
android:id="#+id/city_field_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toEndOf="#+id/profile_image"
android:includeFontPadding="false"
android:text="user_city"
android:textSize="14sp" />
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="-80dp"
android:padding="20dp">
<com.google.android.material.card.MaterialCardView
android:layout_width="0dp"
android:layout_height="125dp"
android:layout_margin="10dp"
android:layout_weight="1"
app:cardBackgroundColor="#color/main_color"
app:cardElevation="10dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="5dp">
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_centerHorizontal="true"
android:background="#drawable/total_orders"
android:backgroundTint="#color/white" />
<TextView
android:id="#+id/totalOrders"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:fontFamily="#font/bungee"
android:includeFontPadding="false"
android:text="12"
android:textColor="#color/white"
android:textSize="20sp" />
<TextView
android:id="#+id/total_orders_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/totalOrders"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:includeFontPadding="false"
android:text="Total Orders"
android:textColor="#color/white"
android:textSize="18sp" />
</RelativeLayout>
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.card.MaterialCardView
android:layout_width="0dp"
android:layout_height="125dp"
android:layout_margin="10dp"
android:layout_weight="1"
app:cardBackgroundColor="#color/main_color"
app:cardElevation="10dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="5dp">
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_centerHorizontal="true"
android:background="#drawable/pending_orders"
android:backgroundTint="#color/white" />
<TextView
android:id="#+id/pendingOrders"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:fontFamily="#font/bungee"
android:includeFontPadding="false"
android:text="0"
android:textColor="#color/white"
android:textSize="20sp" />
<TextView
android:id="#+id/pendingOrders_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/pendingOrders"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:includeFontPadding="false"
android:text="Pending Orders"
android:textColor="#color/white"
android:textSize="18sp" />
</RelativeLayout>
</com.google.android.material.card.MaterialCardView>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="19dp"
android:orientation="vertical">
<androidx.appcompat.widget.AppCompatEditText
android:id="#+id/user_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:background="#drawable/profile_edittext_shape"
android:drawableLeft="#drawable/ic_person_black_24dp"
android:drawablePadding="10dp"
android:elevation="3dp"
android:hint="Name"
android:inputType="textPersonName"
android:padding="13dp"
android:textCursorDrawable="#drawable/cursor_color_edittext" />
<androidx.appcompat.widget.AppCompatEditText
android:id="#+id/user_mobile"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:background="#drawable/profile_edittext_shape"
android:drawableLeft="#drawable/ic_baseline_phone_iphone_24"
android:drawablePadding="10dp"
android:elevation="3dp"
android:hint="Mobile Number"
android:inputType="phone"
android:padding="13dp"
android:textCursorDrawable="#drawable/cursor_color_edittext" />
<androidx.appcompat.widget.AppCompatEditText
android:id="#+id/user_city"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:background="#drawable/profile_edittext_shape"
android:drawableLeft="#drawable/ic_baseline_location_city_24"
android:drawablePadding="10dp"
android:elevation="3dp"
android:hint="City"
android:inputType="text"
android:padding="13dp"
android:textCursorDrawable="#drawable/cursor_color_edittext" />
<androidx.appcompat.widget.AppCompatEditText
android:id="#+id/user_address"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:background="#drawable/profile_edittext_shape"
android:drawableLeft="#drawable/ic_baseline_location_on_24"
android:drawablePadding="10dp"
android:elevation="3dp"
android:hint="Address"
android:inputType="text"
android:padding="13dp"
android:textCursorDrawable="#drawable/cursor_color_edittext" />
<Button
android:id="#+id/btnUpdate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:background="#drawable/bg_btn"
android:fontFamily="#font/bungee"
android:text="UPDATE"
app:backgroundTint="#color/main_color" />
<Button
android:id="#+id/btnLogout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:background="#drawable/bg_btn"
android:fontFamily="#font/bungee"
android:text="Logout"
app:backgroundTint="#color/main_color" />
</LinearLayout>
</LinearLayout>
</ScrollView>
```
Try using editText.setShowSoftInputOnFocus(true) and editText.setFocusable(true)
Also check your AndoridManifest.xml and add android:windowSoftInputMode="stateAlwaysVisible" to corresponding activity, or adjustResize.
<activity
android:name="com.fortrun.testcrashlytics.MainActivity"
android:windowSoftInputMode="adjustResize" >
</activity>
"adjustResize" The activity's main window is always resized to make
room for the soft keyboard on screen.
"stateAlwaysVisible" The soft keyboard is visible when the window receives input focus.
This is what i am trying to achieve
But
this is what i get when uploaded on phone.
It seems ok in android studio fragment design preview but when uploaded on phone
checkboxes are not displayed :(.
Any better solutions?
Below is full xml 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:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="false"
tools:context=".MainFragment">
<TextView
android:id="#+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:autoText="false"
android:text="#string/getnotif"
android:layout_below="#+id/linearLayout5"
android:layout_centerHorizontal="true"
android:layout_marginTop="30dp" />
<CheckBox
android:id="#+id/checkBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView"
android:layout_alignStart="#+id/textView"
android:layout_below="#+id/textView"
android:text="#string/mcall"
android:textSize="12sp" />
<CheckBox
android:id="#+id/checkBox2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/textView"
android:layout_toEndOf="#+id/checkBox"
android:layout_toRightOf="#+id/checkBox"
android:text="#string/msms"
android:textSize="12sp" />
<Button
android:id="#+id/timePicker"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:text="00:00"
android:background="#3f51b5"
android:layout_alignTop="#+id/timePicker2"
android:layout_marginLeft="25dp"
android:layout_alignParentStart="true"
android:textColor="#ffffff" />
<Button
android:id="#+id/timePicker2"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:text="23:59"
android:background="#3f51b5"
android:layout_below="#+id/linearLayout4"
android:layout_alignParentLeft="false"
android:layout_alignParentStart="false"
android:layout_alignParentEnd="false"
android:layout_marginRight="25dp"
android:layout_alignParentRight="true"
android:textColor="#ffffff" />
<LinearLayout
android:id="#+id/linearLayout"
android:layout_width="wrap_content"
android:layout_height="20dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="#+id/timePicker"
android:layout_marginTop="20dp"
android:orientation="horizontal"
android:layout_alignParentEnd="true">
<TextView
android:id="#+id/textView8"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="0dp"
android:text="Days"
android:gravity="center" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/linearLayout"
android:orientation="horizontal"
android:layout_alignRight="#+id/linearLayout"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp">
<CheckBox
android:id="#+id/checkBox3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="false"
android:checked="false"
android:layout_weight="1"
android:text="#string/monday"
android:paddingLeft="-27dp"
android:paddingTop="40dp"
android:textSize="10dp" />
<CheckBox
android:id="#+id/checkBox4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="false"
android:layout_weight="1"
android:text="#string/tuesday"
android:paddingLeft="-26dp"
android:paddingTop="40dp"
android:textSize="10dp" />
<CheckBox
android:id="#+id/checkBox5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="false"
android:layout_weight="1"
android:text="#string/wednesday"
android:paddingLeft="-27dp"
android:paddingTop="40dp"
android:textSize="10dp" />
<CheckBox
android:id="#+id/checkBox6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="false"
android:layout_weight="1"
android:text="#string/thursday"
android:paddingLeft="-27dp"
android:paddingTop="40dp"
android:textSize="10dp" />
<CheckBox
android:id="#+id/checkBox7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="false"
android:layout_weight="1"
android:text="#string/friday"
android:paddingLeft="-24dp"
android:paddingTop="40dp"
android:textSize="10dp" />
<CheckBox
android:id="#+id/checkBox8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="false"
android:checked="false"
android:layout_weight="1"
android:text="#string/saturday"
android:paddingLeft="-25dp"
android:paddingTop="40dp"
android:textSize="10dp" />
<CheckBox
android:id="#+id/checkBox9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="false"
android:checked="false"
android:text="#string/sunday"
android:paddingLeft="-27dp"
android:paddingTop="40dp"
android:textSize="10dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:orientation="horizontal">
<Button
android:id="#+id/exitButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="#drawable/button_state"
android:text="Exit"
android:layout_weight="0.5"
android:layout_marginRight="16dp"
android:textColor="#ffffff" />
<Button
android:id="#+id/saveButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="#drawable/button_state"
android:text="Save"
android:layout_weight="0.5"
android:layout_marginLeft="16dp"
android:textColor="#ffffff" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="false"
android:layout_marginTop="20dp"
android:id="#+id/linearLayout4"
android:layout_alignParentEnd="false">
<TextView
android:id="#+id/textView7"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:text="#string/from"
android:layout_below="#+id/textView5"
android:layout_alignParentLeft="false"
android:layout_alignParentStart="false"
android:gravity="center"
android:layout_marginTop="20dp"
android:layout_marginLeft="25dp" />
<TextView
android:id="#+id/textView23"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="0dp"
android:text="Time"
android:gravity="center"
android:layout_weight="1" />
<TextView
android:id="#+id/textView6"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:text="#string/to"
android:layout_below="#+id/textView5"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:gravity="center"
android:layout_marginTop="20dp"
android:layout_marginRight="25dp" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout5"
android:layout_width="fill_parent"
android:layout_height="60dp"
android:orientation="horizontal"
android:layout_below="#+id/linearLayout2"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
</LinearLayout>
</RelativeLayout>
Set all your checkboxes with layout_weight=1 inside a LinearLayout. Set the Linear Layout's orientation to vertical.
<?xml version="1.0" encoding="utf-8"?>
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Mon"
android:layout_weight="1"
android:id="#+id/checkBox"/>
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Tue"
android:layout_weight="1"
android:id="#+id/checkBox2"/>
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Wed"
android:layout_weight="1"
android:id="#+id/checkBox3"/>
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Thu"
android:layout_weight="1"
android:id="#+id/checkBox4"/>
I have tested your design in an activity , it's displaying fine in full screen.
[![like this][1]][1]
[1]: http://i.stack.imgur.com/0B1hz.png
Make sure you have given Fragment width and height to match parent.
<Fragment
android:width="match_parent"
android:height="match_parent"
/>
New androidtudio preview
And
the result on phone
Bellow is code modified as you suggested.
<?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:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="false"
tools:context=".MainFragment">
<TextView
android:id="#+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:autoText="false"
android:text="#string/getnotif"
android:layout_below="#+id/linearLayout2"
android:layout_centerHorizontal="true" />
<CheckBox
android:id="#+id/checkBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView"
android:layout_alignStart="#+id/textView"
android:layout_below="#+id/textView"
android:text="#string/mcall"
android:textSize="12sp" />
<CheckBox
android:id="#+id/checkBox2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/textView"
android:layout_toEndOf="#+id/checkBox"
android:layout_toRightOf="#+id/checkBox"
android:text="#string/msms"
android:textSize="12sp" />
<Button
android:id="#+id/timePicker"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:text="00:00"
android:background="#3f51b5"
android:layout_alignTop="#+id/timePicker2"
android:layout_marginLeft="25dp"
android:layout_alignParentStart="true"
android:textColor="#ffffff" />
<Button
android:id="#+id/timePicker2"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:text="23:59"
android:background="#3f51b5"
android:layout_below="#+id/linearLayout4"
android:layout_alignParentLeft="false"
android:layout_alignParentStart="false"
android:layout_alignParentEnd="false"
android:layout_marginRight="25dp"
android:layout_alignParentRight="true"
android:textColor="#ffffff" />
<LinearLayout
android:id="#+id/linearLayout"
android:layout_width="wrap_content"
android:layout_height="20dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="#+id/timePicker"
android:layout_marginTop="20dp"
android:orientation="horizontal"
android:layout_alignParentEnd="true">
<TextView
android:id="#+id/textView8"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="0dp"
android:text="Days"
android:gravity="center" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/linearLayout"
android:orientation="vertical"
android:layout_alignRight="#+id/linearLayout"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp">
<CheckBox
android:id="#+id/checkBox3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="MON"
android:layout_weight="1" />
<CheckBox
android:id="#+id/checkBox4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TUE"
android:layout_weight="1"/>
<CheckBox
android:id="#+id/checkBox5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="WED"
android:layout_weight="1" />
<CheckBox
android:id="#+id/checkBox6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="THU"
android:layout_weight="1" />
<CheckBox
android:id="#+id/checkBox7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="FRI"
android:layout_weight="1" />
<CheckBox
android:id="#+id/checkBox8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SAT"
android:layout_weight="1"/>
<CheckBox
android:id="#+id/checkBox9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SUN"
android:layout_weight="1" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:orientation="horizontal">
<Button
android:id="#+id/exitButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="#drawable/button_state"
android:text="Exit"
android:layout_weight="0.5"
android:layout_marginRight="16dp"
android:textColor="#ffffff" />
<Button
android:id="#+id/saveButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="#drawable/button_state"
android:text="Save"
android:layout_weight="0.5"
android:layout_marginLeft="16dp"
android:textColor="#ffffff" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="false"
android:layout_marginTop="20dp"
android:id="#+id/linearLayout4"
android:layout_alignParentEnd="false">
<TextView
android:id="#+id/textView7"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:text="#string/from"
android:layout_below="#+id/textView5"
android:layout_alignParentLeft="false"
android:layout_alignParentStart="false"
android:gravity="center"
android:layout_marginTop="20dp"
android:layout_marginLeft="25dp" />
<TextView
android:id="#+id/textView23"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="0dp"
android:text="Time"
android:gravity="center"
android:layout_weight="1" />
<TextView
android:id="#+id/textView6"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:text="#string/to"
android:layout_below="#+id/textView5"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:gravity="center"
android:layout_marginTop="20dp"
android:layout_marginRight="25dp" />
</LinearLayout>
</RelativeLayout>
I didn't managed to align properly the text boxes under the check boxes.
I have inserted the layout into a scroll view and i can properly see all of them know.
It is good enough for me.
I am working on the UI of my app.
The graphical layout I get in Eclipse while coding looks perfect and as that should be.
But when I launch the app either on an emulator or on a device, it gets distorted.
Every UI component, like Buttons, EditTexts and TextViews.
All the margins and paddings just get lost.
<LinearLayout
android:id="#+id/ll_grand_parent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:gravity="fill_horizontal"
android:orientation="vertical"
android:weightSum="10" >
<LinearLayout
android:id="#+id/ll_button_signin_create_account"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="fill"
android:layout_marginLeft="7dp"
android:layout_marginTop="29dp"
android:layout_weight="2"
android:orientation="horizontal"
android:visibility="visible"
>
<Button
android:id="#+id/button_common_singin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/transparent_button"
android:gravity="center"
android:text="Sign In"
android:textColor="#FFFFFF"
android:textSize="13sp" />
<Button
android:id="#+id/button_common_create_account"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/colored_button"
android:gravity="center"
android:text="Create Account"
android:textColor="#FFFFFF"
android:textSize="13sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/signin_main"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="5.24"
android:orientation="vertical"
android:visibility="gone" >
<LinearLayout
android:id="#+id/ll_parent_signin_email_password"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="20sp"
android:layout_weight=".8"
android:background="#drawable/border"
android:orientation="vertical"
android:visibility="visible" >
<LinearLayout
android:id="#+id/ll_signin_email"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="center"
android:layout_weight="2"
android:orientation="horizontal"
android:visibility="visible"
android:weightSum="10" >
<TextView
android:id="#+id/textview_space_signin_email"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="2" />
<TextView
android:id="#+id/textview_signin_email"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="3"
android:gravity="center"
android:text="Email"
android:textColor="#FFFFFF" />
<EditText
android:id="#+id/edittext_signin_email"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="3"
android:background="#android:color/transparent"
android:gravity="center"
android:hint="john#hotmail.com"
android:textColorHint="#FFFFFF"
android:textSize="13dp" />
</LinearLayout>
<View
android:id="#+id/view_line_signin_email_password"
android:layout_width="fill_parent"
android:layout_height="1dip"
android:background="#FFFFFF" />
<LinearLayout
android:id="#+id/ll_signin_password"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="center"
android:layout_weight="2"
android:orientation="horizontal"
android:visibility="visible"
android:weightSum="10" >
<TextView
android:id="#+id/textview_space_signin_password"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1" />
<TextView
android:id="#+id/textview_signin_password"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="3"
android:gravity="center"
android:text="Password"
android:textColor="#FFFFFF" />
<EditText
android:id="#+id/edittext_signin_password"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="4.49"
android:background="#android:color/transparent"
android:gravity="center"
android:hint="*********"
android:password="true"
android:textColorHint="#FFFFFF" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/ll_signin_logme_parent_button"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_marginTop="20dp"
android:layout_weight="1"
android:orientation="horizontal"
android:visibility="visible"
android:weightSum="10" >
<TextView
android:id="#+id/textview_space_signin_loginme_button_lhs"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1" />
<Button
android:id="#+id/button_signin_loginme"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="7"
android:background="#219AC7"
android:gravity="center"
android:text="Login Me"
android:textColor="#FFFFFF" />
<ImageView
android:id="#+id/textview_space_signin_logmebutton_rhs"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight=".7" />
</LinearLayout>
<RelativeLayout
android:id="#+id/relative_layout_signin_parent_forgetpassword"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_marginLeft="14dp"
android:layout_marginTop="9dp"
android:visibility="visible" >
<TextView
android:id="#+id/textview_signin_forget_password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="forget password"
android:textColor="#000000" />
</RelativeLayout>
<LinearLayout
android:id="#+id/ll_signin_orline_draw_parent"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_gravity="center"
android:layout_weight="1"
android:orientation="horizontal"
android:visibility="visible"
android:weightSum="10" >
<View
android:layout_width="fill_parent"
android:layout_height="1dip"
android:layout_gravity="center"
android:layout_weight="4"
android:background="#000000"
android:padding="20dp" />
<ImageView
android:id="#+id/imageview_signin_or_drawline"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="2"
android:src="#drawable/or" />
<View
android:layout_width="fill_parent"
android:layout_height="1dip"
android:layout_gravity="center"
android:layout_weight="4"
android:background="#000000"
android:padding="20dp" />
</LinearLayout>
<LinearLayout
android:id="#+id/ll_signin_parent_loginwith_facebook"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_marginTop="13dp"
android:layout_weight="1"
android:orientation="horizontal"
android:visibility="visible"
android:weightSum="10" >
<TextView
android:id="#+id/textview_space_signin_facebook_lhs"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
<ImageView
android:id="#+id/imageview_signin_facebook_logo"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2"
android:background="#drawable/fb" />
<Button
android:id="#+id/button_singin_facebook"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="6"
android:background="#3B5998"
android:text="login with facebook"
android:textColor="#FFFFFF" />
<TextView
android:id="#+id/textview_space_sigin_facebook_rhs"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/signup_main"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="6"
android:orientation="vertical"
android:visibility="visible" >
<LinearLayout
android:id="#+id/ll_signup_parentlayout_name"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="20sp"
android:layout_weight=".8"
android:background="#drawable/border"
android:orientation="vertical"
android:visibility="visible" >
<LinearLayout
android:id="#+id/ll_singnup_firstname"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="center"
android:layout_weight="2"
android:orientation="horizontal"
android:visibility="visible"
android:weightSum="10" >
<TextView
android:id="#+id/textview_signup_firstname"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="3"
android:gravity="center"
android:text="First Name"
android:textColor="#FFFFFF" />
<EditText
android:id="#+id/edittext_signup_firstname"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="3"
android:background="#android:color/transparent"
android:gravity="center"
android:hint="John"
android:singleLine="true"
android:textColor="#FFFFFF"
android:textColorHint="#FFFFFF"
/>
<EditText
android:id="#+id/edittext_singup_email"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="3"
android:background="#android:color/transparent"
android:gravity="center"
android:hint="john#xyz.com"
android:singleLine="true"
android:textColor="#FFFFFF"
android:textColorHint="#FFFFFF"
android:textSize="13dp"
android:visibility="gone" >
</EditText>
</LinearLayout>
<View
android:id="#+id/view_signup_line_draw_name_first_last_name"
android:layout_width="fill_parent"
android:layout_height="1dip"
android:background="#FFFFFF" />
<LinearLayout
android:id="#+id/ll_signup_lastname"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="center"
android:layout_weight="2"
android:orientation="horizontal"
android:visibility="visible"
android:weightSum="10" >
<TextView
android:id="#+id/textview_signup_lastname"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="3"
android:gravity="center"
android:text="Last Name"
android:textColor="#FFFFFF" />
<EditText
android:id="#+id/edittext_signup_lastname"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="4.47"
android:background="#android:color/transparent"
android:gravity="center"
android:hint="Smith"
android:password="false"
android:singleLine="true"
android:textColor="#FFFFFF"
android:textColorHint="#FFFFFF" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/ll_singnup_email_parent"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="20sp"
android:layout_weight=".8"
android:background="#drawable/border"
android:orientation="vertical"
android:visibility="visible" >
<LinearLayout
android:id="#+id/ll_signup_email_address"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="center"
android:layout_weight="2"
android:orientation="horizontal"
android:weightSum="10" >
<TextView
android:id="#+id/textview_signup_email"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="3"
android:gravity="center"
android:text="Email Address"
android:textColor="#FFFFFF" />
<EditText
android:id="#+id/edittext_signup_enteremail"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="4.49"
android:background="#android:color/transparent"
android:gravity="center"
android:hint="john#xyz.com"
android:password="false"
android:singleLine="true"
android:textColor="#FFFFFF"
android:textColorHint="#FFFFFF" />
</LinearLayout>
<View
android:id="#+id/view_signup_draw_line_email"
android:layout_width="fill_parent"
android:layout_height="1dip"
android:background="#FFFFFF" />
<LinearLayout
android:id="#+id/ll_signup_reenter_email"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="center"
android:layout_weight="2"
android:orientation="horizontal"
android:visibility="visible"
android:weightSum="10" >
<TextView
android:id="#+id/textview_signup_reenteremail"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="3"
android:gravity="center"
android:singleLine="true"
android:text="Re Enter Email Address"
android:textColor="#FFFFFF" />
<EditText
android:id="#+id/edittext_signup_reenteremail"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="4.49"
android:background="#android:color/transparent"
android:gravity="center"
android:hint="john#xyz.com"
android:password="false"
android:singleLine="true"
android:textColor="#FFFFFF"
android:textColorHint="#FFFFFF" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/ll_signup_dob_button_parent"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="13dp"
android:divider="#drawable/divider"
android:gravity="center"
android:orientation="horizontal"
android:showDividers="middle"
android:visibility="visible"
android:weightSum="3" >
<Button
android:id="#+id/button_signup_day"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/round_button"
android:text="BirthDate"
android:textColor="#000000"
android:textSize="10sp" />
<Button
android:id="#+id/button_signup_month"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/round_button"
android:divider="#drawable/divider"
android:showDividers="middle"
android:text="BirthMonth"
android:textColor="#000000"
android:textSize="10sp" />
<Button
android:id="#+id/button_singup_year"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/round_button"
android:singleLine="true"
android:text="BirthYear"
android:textColor="#000000"
android:textSize="10sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/ll_singup_radio_gender_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginTop="10dp"
android:orientation="horizontal"
android:visibility="visible" >
<RadioGroup
android:id="#+id/radio_signup_radiogroup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<RadioButton
android:id="#+id/radiobutton_signup_male"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:cursorVisible="true"
android:text="male "
android:textColor="#FFFFFF"
android:textColorHighlight="#ED933E" />
<RadioButton
android:id="#+id/radiobutton_signup_female"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="female"
android:textColor="#FFFFFF" />
</RadioGroup>
</LinearLayout>
<Button
android:id="#+id/button_signup_createaccount"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="13dp"
android:layout_marginRight="13dp"
android:layout_weight=".003"
android:background="#drawable/colored_button"
android:text="Create My Account"
android:visibility="visible" />
</LinearLayout>
These are the causes of your issue
android:weightSum="10"
You have to fill parent on every view and give each one a weight to just to make this work. You can achieve a good looking app that way but it is quite labor intensive and we have not even discussed text size among different devices.
Also other stuff like
android:layout_marginLeft="7dp"
Imagine a 10 inch tablet and a normal sized phone. Think of the different dimensions of the two and how your application will stretch . What happens if your turn your app sideways? How would it look then?
Go here and when your done reading it read it again.
http://developer.android.com/training/basics/supporting-devices/screens.html
I have created a Scroll view and it contains some Linear layouts that contains some views but issue is that the last view is not showing inside scroll view My Linear layout is not expending and android:fillViewport="true" is not working, i will post screen shot
MY Output is
MY XML CODE IS
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar_filters"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#2f3f9f"
android:minHeight="?attr/actionBarSize"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light"
app:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar" >
<TextView
android:id="#+id/toolbar_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="FILTERS"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#color/white" />
</android.support.v7.widget.Toolbar>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true"
android:layout_below="#+id/toolbar_filters"
android:background="#202231" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#202231"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:background="#2a2d41"
android:orientation="horizontal"
android:weightSum="2" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical" >
<TextView
android:id="#+id/open_now"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingBottom="5dp"
android:paddingLeft="20dp"
android:paddingTop="5dp"
android:text="Opne Now"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/white" />
<View
android:id="#+id/view_open_now"
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="#2a2d41" />
<TextView
android:id="#+id/smoking_inside"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingBottom="5dp"
android:paddingLeft="20dp"
android:paddingTop="10dp"
android:text="Smoking Inside"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/white" />
<View
android:id="#+id/view_smoking_inside"
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="#2a2d41" />
<TextView
android:id="#+id/shots"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingBottom="5dp"
android:paddingLeft="20dp"
android:paddingTop="10dp"
android:text="Shots"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/white" />
<View
android:id="#+id/view_shots"
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="#2a2d41" />
<TextView
android:id="#+id/vvip"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingBottom="5dp"
android:paddingLeft="20dp"
android:paddingTop="10dp"
android:text="VVIP"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/white" />
<View
android:id="#+id/view_vvip"
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="#2a2d41" />
<TextView
android:id="#+id/terrace"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingBottom="5dp"
android:paddingLeft="20dp"
android:paddingTop="10dp"
android:text="Terrace"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/white" />
<View
android:id="#+id/view_terrace"
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="#2a2d41" />
</LinearLayout>
<View
android:id="#+id/view_vertical"
android:layout_width="2dp"
android:layout_height="match_parent"
android:background="#2a2d41" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical" >
<TextView
android:id="#+id/karoake"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingBottom="5dp"
android:paddingLeft="20dp"
android:paddingTop="5dp"
android:text="Karaoke"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/white" />
<View
android:id="#+id/view_karoake"
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="#2a2d41" />
<TextView
android:id="#+id/cigar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingBottom="5dp"
android:paddingLeft="20dp"
android:paddingTop="10dp"
android:text="Cigar"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/white" />
<View
android:id="#+id/view_cigar"
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="#2a2d41" />
<TextView
android:id="#+id/vip"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingBottom="5dp"
android:paddingLeft="20dp"
android:paddingTop="10dp"
android:text="VIP"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/white" />
<View
android:id="#+id/view_vip"
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="#2a2d41" />
<TextView
android:id="#+id/sea_side"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingBottom="5dp"
android:paddingLeft="20dp"
android:paddingTop="10dp"
android:text="Sea Side"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/white" />
<View
android:id="#+id/view_sea_side"
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="#2a2d41" />
<TextView
android:id="#+id/swimming_pool"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingBottom="5dp"
android:paddingLeft="20dp"
android:paddingTop="10dp"
android:text="Swimming Pool"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/white" />
<View
android:id="#+id/view_swimming_pool"
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="#2a2d41" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/music_selection_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:background="#2a2d41"
android:orientation="horizontal" >
<TextView
android:id="#+id/filter_music"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="5dp"
android:layout_weight="1"
android:gravity="left"
android:text="Music"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/white" />
<TextView
android:id="#+id/filter_music_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:gravity="right"
android:paddingRight="8dp"
android:text="(0)"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#color/white" />
<TextView
android:id="#+id/filter_music_fonts"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:gravity="right"
android:paddingRight="8dp"
android:text=">"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#color/white" />
</LinearLayout>
<LinearLayout
android:id="#+id/cuisine_layouts"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:background="#2a2d41"
android:orientation="horizontal" >
<TextView
android:id="#+id/filter_cuisines"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="5dp"
android:layout_weight="1"
android:gravity="left"
android:text="Cuisines"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/white" />
<TextView
android:id="#+id/filter_cuisines_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:gravity="right"
android:paddingRight="8dp"
android:text="(0)"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#color/white" />
<TextView
android:id="#+id/filter_cuisines_fonts"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:gravity="right"
android:paddingRight="8dp"
android:text=">"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#color/white" />
</LinearLayout>
<LinearLayout
android:id="#+id/outlet_type_layouts"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:background="#2a2d41"
android:orientation="horizontal" >
<TextView
android:id="#+id/filter_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="5dp"
android:layout_weight="1"
android:gravity="left"
android:text="Type"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/white" />
<TextView
android:id="#+id/filter_type_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:gravity="right"
android:paddingRight="8dp"
android:text="(0)"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#color/white" />
<TextView
android:id="#+id/filter_type_fonts"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:gravity="right"
android:paddingRight="8dp"
android:text=">"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#color/white" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:background="#2a2d41"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="#+id/filter_cover_charges_upto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="5dp"
android:gravity="left"
android:text="COVER CHARGES UPTO"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/white" />
<View
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1" />
<TextView
android:id="#+id/filter_cover_charges_upto_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:background="#drawable/back"
android:gravity="left"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:text="50"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/white" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="#+id/seekBar_value_min"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginTop="5dp"
android:gravity="top"
android:text="0"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/white" />
<SeekBar
android:id="#+id/seekBar1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:max="999" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:gravity="top"
android:text="999"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/white" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:background="#2a2d41"
android:orientation="horizontal" >
<TextView
android:id="#+id/filter_guest_list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="5dp"
android:layout_weight="1"
android:gravity="left"
android:text="GUESTLIST UPTO"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/white" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:layout_weight="1"
android:gravity="right"
android:paddingRight="2dp"
android:text="23:30"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/white" />
<TextView
android:id="#+id/filter_arrow_fonts"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:gravity="right"
android:paddingRight="8dp"
android:text=">"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#color/white" />
</LinearLayout>
</LinearLayout>
</ScrollView>
<LinearLayout
android:id="#+id/wrapper_button"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:orientation="horizontal" >
<Button
android:id="#+id/activate_plans_btn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#2f3f9f"
android:text="SUBMIT"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#ffffff" />
</LinearLayout>
</RelativeLayout>
Change height of ScrollView to wrap content or you can also put your ScrollView and the last LinearLayout into another LinearLayout having vertical orientation with fill_parent dimensions and add the weight property to both of them.
Try this for your last Linear Layout
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:layout_marginBottom="20dp"
android:background="#2a2d41"
android:orientation="horizontal" >
<TextView
android:id="#+id/filter_guest_list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="5dp"
android:layout_weight="1"
android:gravity="left"
android:text="GUESTLIST UPTO"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/white" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:layout_weight="1"
android:gravity="right"
android:paddingRight="2dp"
android:text="23:30"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/white" />
<TextView
android:id="#+id/filter_arrow_fonts"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:gravity="right"
android:paddingRight="8dp"
android:text=">"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#color/white" />
</LinearLayout>
I'm following an example in my book, but I can't get the seekbar in the said example to be large enough as the book shows and even the example code from the book site shows.
this is the layout declaration and the concerned row. Do you know what is the difference related to?
Expected Result and given result (yes the book was made for 2.3):
http://i.stack.imgur.com/9QT9j.png
http://i.stack.imgur.com/J7Cpr.png
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/tableLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFF"
android:padding="5dp"
android:stretchColumns="1,2,3" >
<TableRow
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:id="#+id/tableRow0">
<TextView
android:id="#+id/billTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/billTotal"
android:textColor="#000"
android:gravity="right"
android:paddingRight="5dp" />
<EditText
android:id="#+id/billEditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_span="3"
android:inputType="numberDecimal"
android:layout_weight="1">
</EditText>
</TableRow>
<TableRow
android:id="#+id/tableRow1"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/tenTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="1"
android:textColor="#000"
android:gravity="center"
android:layout_weight="1"
android:text="10%" />
<TextView
android:id="#+id/fifteenTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="15%"
android:textColor="#000"
android:gravity="center"
android:layout_weight="1"/>
<TextView
android:id="#+id/twentyTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="20%"
android:textColor="#000"
android:gravity="center"
android:layout_weight="1"/>
</TableRow>
<TableRow
android:id="#+id/tableRow2"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/tipTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right"
android:paddingRight="5dp"
android:text="#string/tip" />
<EditText
android:id="#+id/tip10EditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:longClickable="false"
android:text="#string/zero" />
<EditText
android:id="#+id/tip15EditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:focusable="false"
android:longClickable="false"
android:text="#string/zero" />
<EditText
android:id="#+id/tip20EditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:focusable="false"
android:longClickable="false"
android:text="#string/zero" />
</TableRow>
<TableRow
android:id="#+id/tableRow3"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/totalTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right"
android:paddingRight="5dp"
android:text="#string/total" />
<EditText
android:id="#+id/total10EditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:focusable="false"
android:longClickable="false"
android:text="#string/zero" />
<EditText
android:id="#+id/total15EditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:focusable="false"
android:longClickable="false"
android:text="#string/zero" />
<EditText
android:id="#+id/total20EditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:focusable="false"
android:longClickable="false"
android:text="#string/zero" />
</TableRow>
<TableRow
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:id="#+id/tableRow4">
<TextView
android:id="#+id/customTextView"
android:layout_width="wrap_content"
android:text="#string/custom"
android:textColor="#000"
android:paddingRight="5dp"
android:gravity="right|center_vertical"
android:layout_height="match_parent"
android:paddingBottom="5dp"
android:focusable="false"/>
<SeekBar
android:id="#+id/customSeekBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_span="2"
android:layout_weight="1"
android:paddingBottom="5dp"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:progress="18" />
<TextView
android:id="#+id/customTipTextView"
android:layout_width="wrap_content"
android:text="18%"
android:textColor="#000"
android:gravity="center_vertical"
android:layout_height="match_parent"
android:paddingLeft="5dp"
android:paddingBottom="5dp"
android:focusable="false"
android:layout_weight="1"
/>
</TableRow>
<TableRow
android:id="#+id/tableRow5"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/tipCustomTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right"
android:paddingRight="5dp"
android:text="#string/tip" />
<EditText
android:id="#+id/tipCustomEditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:focusable="false"
android:longClickable="false"
android:text="#string/zero" />
<TextView
android:id="#+id/totalCustomTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right"
android:layout_weight="1"
android:paddingRight="5dp"
android:text="#string/total" />
<EditText
android:id="#+id/totalCustomEditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:focusable="false"
android:longClickable="false"
android:text="#string/zero" />
</TableRow>
</TableLayout>