Upper half the characters entered in EditText field are not visible - android

In Android Project, upper half of the characters entered in the EditText field are not visible. I tried reducing the fonts from 25sp to 18sp, more part of the letters visible but problem still persists. Reducing font size less than that looks odd in the app. I tried on Margins and padding too, but no result. Please help.
Part of the Layout file :-
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/ScrollView01"
xmlns:android="http://schemas.android.com/apk/res/android"
android:fillViewport="true"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<android.support.constraint.ConstraintLayout 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"
android:id="#+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#4ab4b2"
tools:layout_editor_absoluteY="81dp">
<TableLayout
android:id="#+id/tableLayout2"
android:layout_width="351dp"
android:layout_height="427dp"
android:layout_marginEnd="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TableRow
android:layout_width="match_parent"
android:layout_height="50dp">
<TextView
android:id="#+id/lableDenom"
android:layout_width="60dp"
android:layout_height="35dp"
android:background="#color/colorPrimaryDark"
android:text="Denom"
android:textColor="#android:color/background_light"
android:textSize="18sp"
android:textStyle="bold"
tools:layout_editor_absoluteX="16dp"
tools:layout_editor_absoluteY="14dp" />
<TextView
android:id="#+id/lableQty"
android:layout_width="wrap_content"
android:layout_height="35dp"
android:background="#color/colorPrimaryDark"
android:paddingLeft="10dp"
android:text="Qty"
android:textAllCaps="false"
android:textColor="#android:color/background_light"
android:textSize="18sp"
android:textStyle="bold"
tools:layout_editor_absoluteX="16dp"
tools:layout_editor_absoluteY="14dp" />
<TextView
android:id="#+id/lableValue"
android:layout_width="150dp"
android:layout_height="35dp"
android:background="#color/colorPrimaryDark"
android:text="Value"
android:textColor="#android:color/background_light"
android:textSize="18sp"
android:textStyle="bold"
tools:layout_editor_absoluteX="16dp"
tools:layout_editor_absoluteY="14dp" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="50dp">
<TextView
android:id="#+id/lable2000"
android:layout_width="60dp"
android:layout_height="35dp"
android:background="#color/Rs_2000"
android:paddingLeft="5dp"
android:text="2000"
android:textColor="#android:color/background_light"
android:textSize="25dp"
android:textStyle="bold"
tools:layout_editor_absoluteX="16dp"
tools:layout_editor_absoluteY="14dp" />
<EditText
android:id="#+id/qty2000"
android:layout_width="100dp"
android:layout_height="35dp"
android:layout_gravity="bottom"
android:ems="10"
android:inputType="number"
android:maxLength="4"
android:textColor="?attr/colorBackgroundFloating"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="#+id/result2000"
android:layout_width="150dp"
android:layout_height="35dp"
android:background="#color/Rs_2000"
android:textColor="#android:color/background_light"
android:textSize="25dp"
android:textStyle="bold"
tools:layout_editor_absoluteX="16dp"
tools:layout_editor_absoluteY="14dp" />
</TableRow> ... ...

Try this :-
<?xml version="1.0" encoding="utf-8"?>
<ScrollView 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"
android:id="#+id/ScrollView01"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true">
<android.support.constraint.ConstraintLayout 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"
android:id="#+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#4ab4b2"
tools:layout_editor_absoluteY="81dp">
<TableLayout
android:id="#+id/tableLayout2"
android:layout_width="351dp"
android:layout_height="427dp"
android:layout_marginEnd="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TableRow
android:layout_width="match_parent"
android:layout_height="50dp">
<TextView
android:id="#+id/lableDenom"
android:layout_width="60dp"
android:layout_height="35dp"
android:background="#color/colorPrimaryDark"
android:text="Denom"
android:textColor="#android:color/background_light"
android:textSize="18sp"
android:textStyle="bold"
tools:layout_editor_absoluteX="16dp"
tools:layout_editor_absoluteY="14dp" />
<TextView
android:id="#+id/lableQty"
android:layout_width="wrap_content"
android:layout_height="35dp"
android:background="#color/colorPrimaryDark"
android:paddingLeft="10dp"
android:text="Qty"
android:textAllCaps="false"
android:textColor="#android:color/background_light"
android:textSize="18sp"
android:textStyle="bold"
tools:layout_editor_absoluteX="16dp"
tools:layout_editor_absoluteY="14dp" />
<TextView
android:id="#+id/lableValue"
android:layout_width="150dp"
android:layout_height="35dp"
android:background="#color/colorPrimaryDark"
android:text="Value"
android:textColor="#android:color/background_light"
android:textSize="18sp"
android:textStyle="bold"
tools:layout_editor_absoluteX="16dp"
tools:layout_editor_absoluteY="14dp" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="50dp">
<TextView
android:id="#+id/lable2000"
android:layout_width="60dp"
android:layout_height="35dp"
android:gravity="center"
android:padding="4dp"
android:background="#color/Rs_2000"
android:text="2000"
android:textColor="#android:color/background_light"
android:textSize="22sp"
android:textStyle="bold"
tools:layout_editor_absoluteX="16dp"
tools:layout_editor_absoluteY="14dp" />
<EditText
android:id="#+id/qty2000"
android:layout_width="100dp"
android:layout_height="40dp"
android:layout_gravity="bottom"
android:ems="10"
android:inputType="number"
android:maxLength="4"
android:textColor="?attr/colorBackgroundFloating"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="#+id/result2000"
android:layout_width="150dp"
android:layout_height="35dp"
android:background="#color/Rs_2000"
android:textColor="#android:color/background_light"
android:textSize="25dp"
android:textStyle="bold"
tools:layout_editor_absoluteX="16dp"
tools:layout_editor_absoluteY="14dp" />
</TableRow>
</TableLayout>
</android.support.constraint.ConstraintLayout>
increase your edittext height according to your code UI as you want and textsize 25sp to 22sp, textPadding 5dp to 4dp.

I got an simple solution for the above problem by googling with different question How to remove the underbar in EditText field.
By adding the following code to EditText, the problem is solved. Now I can keep layout_height at 35dp and textSize at 25sp.
android:background="#00000000"

Related

Scroll View doesn't work in Frame Layout - Android XML

I'm using fragments to recreate a design, so basically my design consists of four buttons which are present in a Relative Layout and the remaining empty space of the activity is used as a fragment.
So everything works fine until the content in the fragment goes beyond the screen and it is not visible anymore. So I want to implement a ScrollView, so the user can scroll to see all the content, but unfortunately that doesn't work. I have been looking for solution all day but nothing helped.
Here is the image for reference.
Every suggestion is appreciated! Thank you.
Here is the code;
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout 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"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".Fragment_1">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/text_1_frame_1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginEnd="10dp"
android:fontFamily="#font/alata"
android:textStyle="bold"
android:text="#string/fragment_1_text_1"
android:textColor="#color/Deloitte"
android:textSize="32sp" />
<ScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="#id/text_1_frame_1"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:id="#+id/rl1_frame_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="25dp"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:background="#drawable/frame_design">
<TextView
android:id="#+id/education_1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="#font/open_sans"
android:padding="10dp"
android:text="#string/bachelors_in_engineering_cse"
android:textColor="#color/white"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="10dp"
android:paddingEnd="10dp"
android:fontFamily="#font/open_sans"
android:layout_below="#id/education_1"
android:text="#string/neil_gogte_institute_of_technology_n_2020_2023"
android:textColor="#color/white"
android:textStyle="italic"
android:textSize="16sp"
android:paddingBottom="10dp"/>
</RelativeLayout>
<RelativeLayout
android:id="#+id/rl1_frame_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/rl1_frame_1"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:background="#drawable/frame_design">
<TextView
android:id="#+id/education_2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="#font/open_sans"
android:padding="10dp"
android:text="#string/diploma_in_computer_science"
android:textColor="#color/white"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="10dp"
android:paddingEnd="10dp"
android:fontFamily="#font/open_sans"
android:layout_below="#id/education_2"
android:text="#string/government_institute_of_electronics_n_2016_2019"
android:textColor="#color/white"
android:textStyle="italic"
android:textSize="16sp"
android:paddingBottom="10dp"/>
</RelativeLayout>
<RelativeLayout
android:id="#+id/rl1_frame_3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/rl1_frame_2"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:background="#drawable/frame_design">
<TextView
android:id="#+id/education_3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="#font/open_sans"
android:padding="10dp"
android:text="#string/ts_ssc"
android:textColor="#color/white"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="10dp"
android:paddingEnd="10dp"
android:fontFamily="#font/open_sans"
android:layout_below="#id/education_3"
android:text="#string/bhashyam_high_school_n_2015_2016"
android:textColor="#color/white"
android:textStyle="italic"
android:textSize="16sp"
android:paddingBottom="10dp"/>
</RelativeLayout>
<RelativeLayout
android:id="#+id/certification_rl"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="25dp"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:layout_below="#id/rl1_frame_3"
android:background="#drawable/frame_design">
<ImageView
android:id="#+id/certification"
android:layout_width="match_parent"
android:layout_marginTop="10dp"
android:layout_height="wrap_content"
android:contentDescription="#string/certificate_icon"
android:layout_centerHorizontal="true"
android:src="#drawable/certification" />
<TextView
android:id="#+id/certification_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/certification"
android:layout_centerHorizontal="true"
android:fontFamily="#font/open_sans"
android:padding="10dp"
android:text="#string/android_basics_nanodegree_by_google"
android:textColor="#color/white"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/certification_1"
android:fontFamily="#font/open_sans"
android:paddingBottom="10dp"
android:layout_centerHorizontal="true"
android:text="Certified on July,2019 "
android:textColor="#color/white"
android:textSize="16sp"
android:textStyle="italic"
tools:ignore="HardcodedText" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/certification_rl_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="25dp"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:layout_below="#id/rl1_frame_3"
android:background="#drawable/frame_design">
<ImageView
android:id="#+id/certification_img"
android:layout_width="match_parent"
android:layout_marginTop="10dp"
android:layout_height="wrap_content"
android:contentDescription="#string/certificate_icon"
android:layout_centerHorizontal="true"
android:src="#drawable/certification" />
<TextView
android:id="#+id/certification_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/certification_img"
android:layout_centerHorizontal="true"
android:fontFamily="#font/open_sans"
android:padding="10dp"
android:text="#string/android_basics_nanodegree_by_google"
android:textColor="#color/white"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/certification_2"
android:fontFamily="#font/open_sans"
android:paddingBottom="10dp"
android:layout_centerHorizontal="true"
android:text="Certified on July,2019 "
android:textColor="#color/white"
android:textSize="16sp"
android:textStyle="italic"
tools:ignore="HardcodedText" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>
</FrameLayout>
Here is main activity for the fragments!
<androidx.constraintlayout.widget.ConstraintLayout 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"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".More_Info">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
android:orientation="horizontal"
android:layout_marginTop="15dp"
android:id="#+id/more_cv_ll">
<RelativeLayout
android:layout_weight="1"
android:id="#+id/rl_1"
android:layout_marginTop="15dp"
android:layout_marginStart="15dp"
android:layout_width="100dp"
android:layout_marginBottom="15dp"
android:background="#drawable/bg_buttons"
android:layout_height="100dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/education"
android:layout_centerInParent="true"/>
</RelativeLayout>
<RelativeLayout
android:layout_weight="1"
android:id="#+id/rl_2"
android:layout_marginStart="15dp"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_marginTop="15dp"
android:background="#drawable/bg_buttons"
android:layout_marginBottom="15dp"
android:layout_toRightOf="#id/rl_1">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="#drawable/skills" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/rl_3"
android:layout_weight="1"
android:layout_marginStart="15dp"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp"
android:background="#drawable/bg_buttons"
android:layout_toRightOf="#id/rl_2">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/work_exp"
android:layout_centerInParent="true"/>
</RelativeLayout>
<RelativeLayout
android:id="#+id/rl_4"
android:layout_weight="1"
android:layout_marginEnd="15dp"
android:layout_marginStart="15dp"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_marginBottom="15dp"
android:background="#drawable/bg_buttons"
android:layout_marginTop="15dp"
android:layout_toRightOf="#id/rl_3">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/contact"
android:layout_centerInParent="true"/>
</RelativeLayout>
</LinearLayout>
<FrameLayout
android:id="#+id/cv_frame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:layout_marginTop="15dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/more_cv_ll" />
</androidx.constraintlayout.widget.ConstraintLayout>
ScrollView must have only 1 child. Currently you have a Linear and a Relative Layout inside it. Make sure to have only 1 layout group inside scrollview eg LinearLayout and then add your views to that LinearLayout

how to adjust textview with screen limits?

I have a cardview in which I am displaying ingredient list but the problem i am facing is sometimes the ingredient name becomes so lengthy that it kicks out the textviews and button next to it out of screen. How can I adjust the entire cardview within screen even if ingredient name becomes lengthy ?
That is the code of my ingredient_list.xml:
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView 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="65dp"
app:cardCornerRadius="12dp"
app:cardElevation="5dp"
android:backgroundTint="#333333"
android:layout_margin="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#333333"
android:layout_margin="4dp"
android:padding="5dp"
android:orientation="horizontal">
<TextView
android:id="#+id/ith_ingredient_inventory"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ingredient i"
android:gravity="center"
android:textColor="#color/colorAccent"
android:textSize="20dp"
android:textStyle="bold"
android:padding="10dp"
/>
<TextView
android:id="#+id/ith_ingredient_quantity_inventory"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="#drawable/round_corners"
android:backgroundTint="#color/colorAccent"
android:text="100"
android:textSize="20dp"
android:textAlignment="center"
android:textColor="#android:color/black"
android:textStyle="bold"
android:padding="5dp"
android:layout_margin="5dp">
</TextView>
<TextView
android:id="#+id/ith_ingredient_quantity_unit_inventory"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="unit"
android:textColor="#color/colorAccent"
android:textSize="16dp"
android:padding="10dp"
/>
<Button
android:id="#+id/add_quantity_inventory"
android:layout_width="35dp"
android:layout_height="35dp"
android:background="#drawable/plus"
android:foreground="?attr/selectableItemBackgroundBorderless"
android:padding="10dp"
android:layout_marginLeft="10dp">
</Button>
</LinearLayout>
</androidx.cardview.widget.CardView>
I changed your LinearLayout to ConstraintLayout and made some other changes:
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView 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="65dp"
android:layout_margin="10dp"
android:backgroundTint="#333333"
app:cardCornerRadius="12dp"
app:cardElevation="5dp">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="4dp"
android:background="#333333"
android:padding="5dp">
<TextView
android:id="#+id/ith_ingredient_inventory"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:ellipsize="end"
android:gravity="center"
android:maxLines="1"
android:text="ingredient i ingredient i ingredient i ingredient i ingredient i"
android:textColor="#color/colorAccent"
android:textSize="20dp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="#+id/ith_ingredient_quantity_inventory"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="#+id/ith_ingredient_quantity_inventory"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_margin="5dp"
android:backgroundTint="#color/colorAccent"
android:text="100"
android:textAlignment="center"
android:textColor="#android:color/black"
android:textSize="20dp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toLeftOf="#+id/ith_ingredient_quantity_unit_inventory"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="#+id/ith_ingredient_quantity_unit_inventory"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="unit"
android:textColor="#color/colorAccent"
android:textSize="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toLeftOf="#+id/add_quantity_inventory"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="#+id/add_quantity_inventory"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_margin="10dp"
android:foreground="?attr/selectableItemBackgroundBorderless"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"></Button>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
and this is the result:
So, you can use ConstraintLayout with my properties and that TextView you want to not cover the other views, must have a maxLine value and ellipsize to show three dots at the end, when it is long.

layout not going all the way to the bottom

I am new to designing layouts , and i am trying to make this layout resizable with
android:windowSoftInputMode="adjustResize"
everything is working perfectly but the problem is i can't get the last relative layout to go all the way to the bottom
i tried to set gravity to bottom but it did not work
i added a line in my code where my problem occurs
here is my activity layout:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView 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"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000000"
tools:context=".testLayout">
<RelativeLayout
android:id="#+id/mainLayout"
android:layout_width="match_parent"
android:gravity="center"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/logoLayout"
>
<ImageView
android:layout_width="140dp"
android:layout_height="35dp"
android:layout_marginTop="10dp"
android:layout_marginStart="10dp"
android:background="#drawable/nlogo">
</ImageView>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="#+id/logoLayout1"
android:layout_below="#id/logoLayout"
>
<EditText
android:id="#+id/testUsernameText"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginStart="50dp"
android:layout_marginTop="48dp"
android:layout_marginEnd="50dp"
android:background="#drawable/rounded_background"
android:gravity="center_vertical"
android:hint="Username"
android:paddingStart="10dp"
android:text=""
android:textColor="#color/white"
android:textColorHint="#color/hint_color"
android:textCursorDrawable="#null"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/imageView2" />
<EditText
android:id="#+id/testPasswordText"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginStart="50dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="50dp"
android:background="#drawable/rounded_background"
android:gravity="center_vertical"
android:hint="Password"
android:paddingStart="10dp"
android:text=""
android:textColor="#color/white"
android:textColorHint="#color/hint_color"
android:textCursorDrawable="#null"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/imageView2" />
<EditText
android:id="#+id/testEmailText"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginStart="50dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="50dp"
android:background="#drawable/rounded_background"
android:gravity="center_vertical"
android:hint="Email"
android:paddingStart="10dp"
android:text=""
android:textColor="#color/white"
android:textColorHint="#color/hint_color"
android:textCursorDrawable="#null"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/imageView2" />
<EditText
android:id="#+id/testFullNameText"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginStart="50dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="50dp"
android:background="#drawable/rounded_background"
android:gravity="center_vertical"
android:hint="Full Name"
android:paddingStart="10dp"
android:text=""
android:textColor="#color/white"
android:textColorHint="#color/hint_color"
android:textCursorDrawable="#null"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/imageView2" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="50dp"
android:layout_marginStart="50dp"
android:layout_marginEnd="50dp"
android:text="Sign Up"
android:background="#drawable/rounded_button"
/>
</LinearLayout>
<!-- here is the problem -->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/logoLayout1"
android:id="#+id/footerLayout"
android:layout_alignParentBottom="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_alignParentBottom="true">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="false"
android:text="Welcome to ....."
android:textSize="15sp" />
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
many thanks in advance
I have tried your layout in my temporary activity and adding android:fillViewport="true" in the ScrollView worked for me.
Here is the solution:
Add this line in Manifest file for your activity
android:windowSoftInputMode="adjustResize"
I have bit modified the XML file code to make it very easy to read and less view hierarchy.
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000000"
android:fillViewport="true">
<LinearLayout
android:id="#+id/mainLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="140dp"
android:layout_height="35dp"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"
android:background="#drawable/ic_eye"
android:contentDescription="#null" />
<EditText
android:id="#+id/testUsernameText"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginStart="50dp"
android:layout_marginTop="48dp"
android:layout_marginEnd="50dp"
android:gravity="center_vertical"
android:hint="Username"
android:paddingStart="10dp"
android:text=""
android:textColor="#color/colorTextWhite"
android:textColorHint="#color/colorTextBlue"
android:textCursorDrawable="#null"
android:textSize="18sp" />
<EditText
android:id="#+id/testPasswordText"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginStart="50dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="50dp"
android:gravity="center_vertical"
android:hint="Password"
android:paddingStart="10dp"
android:text=""
android:textColor="#color/colorTextWhite"
android:textColorHint="#color/colorTextBlue"
android:textCursorDrawable="#null"
android:textSize="18sp" />
<EditText
android:id="#+id/testEmailText"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginStart="50dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="50dp"
android:gravity="center_vertical"
android:hint="Email"
android:paddingStart="10dp"
android:text=""
android:textColor="#color/colorTextWhite"
android:textColorHint="#color/colorTextBlue"
android:textCursorDrawable="#null"
android:textSize="18sp" />
<EditText
android:id="#+id/testFullNameText"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginStart="50dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="50dp"
android:gravity="center_vertical"
android:hint="Full Name"
android:paddingStart="10dp"
android:text=""
android:textColor="#color/colorTextWhite"
android:textColorHint="#color/colorTextBlue"
android:textCursorDrawable="#null"
android:textSize="18sp" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="50dp"
android:layout_marginTop="50dp"
android:layout_marginEnd="50dp"
android:background="#drawable/shape_calendar_bg"
android:text="Sign Up" />
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="bottom"
android:text="Welcome to ....."
android:textColor="#color/colorTextWhite"
android:textSize="15sp" />
</LinearLayout>
</ScrollView>
While the keyboard is open

Output displays differently on a Specific Android Device

I created a simple button and recyclerview on XML in android studio.
For some devices i've tried, the button and recyclerview show up normally.
However this device i mentioned is show up differently.
Here's a the picture.
Recycler View
Button
It supposed to be normal size and no text being cropped.
Has anyone ever find the solution for these matter?
[EDIT]
Here's the related XML code for the button
<?xml version="1.0" encoding="utf-8"?>
<ScrollView 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">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="left"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Dine In/Take Away"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:padding="10dp"
android:textColor="#color/Black"
android:textStyle="bold"/>
<Spinner
android:id="#+id/spDineIn"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:layout_marginBottom="10dp"
android:padding="10dp"
android:spinnerMode="dropdown"
android:entries="#array/array_dine_in"
android:prompt="#string/spinner_dine_in" />
</LinearLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/etlTableNumber"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:layout_marginTop="10dp">
<EditText
android:id="#+id/etTableNumber"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="number"
android:hint="Table Number" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/etlQtyCust"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:layout_marginTop="10dp">
<EditText
android:id="#+id/etQtyCust"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="number"
android:hint="Customer Total" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/etlCustomerName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:layout_marginTop="10dp">
<EditText
android:id="#+id/etCustomerName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Customer Name"
android:inputType="textPersonName" />
</android.support.design.widget.TextInputLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="right"
android:orientation="horizontal">
<Button
android:id="#+id/btnNext"
android:layout_width="110dp"
android:layout_height="55dp"
android:layout_marginTop="8dp"
android:layout_marginRight="8dp"
android:text="Save"
android:textStyle="bold"
android:textColor="#color/ButtonTextColor"
android:background="#drawable/mybutton"
/>
<Button
android:id="#+id/btnMerge"
android:layout_width="110dp"
android:layout_height="55dp"
android:layout_marginTop="8dp"
android:layout_marginRight="8dp"
android:text="Save & Merge"
android:textStyle="bold"
android:textColor="#color/ButtonTextColor"
android:background="#drawable/mybutton"
/>
<Button
android:id="#+id/btnCancel"
android:layout_width="110dp"
android:layout_height="55dp"
android:layout_marginTop="8dp"
android:layout_marginRight="8dp"
android:text="Cancel"
android:textStyle="bold"
android:textColor="#color/ButtonTextColor"
android:background="#drawable/mybutton"
/>
</LinearLayout>
</LinearLayout>
</ScrollView>
TIA
Change android:gravity="right" to android:gravity="center_vertical" in the linear layout containing the buttons

how to set left and right textview and radio button in constraint layout?

<android.support.constraint.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="wrap_content">
<android.support.v7.widget.AppCompatTextView
android:id="#+id/phone_number"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="sans-serif"
android:letterSpacing="0.01"
android:lineSpacingExtra="32sp"
android:text="+44 2079460860"
android:textColor="#color/colorDusk"
android:textSize="16sp"
android:textStyle="normal"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<android.support.v7.widget.AppCompatTextView
android:id="#+id/name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="sans-serif"
android:lineSpacingExtra="32sp"
android:text="Mobile UK"
android:textColor="#color/secondryColor"
android:textSize="14sp"
android:textStyle="normal"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/phone_number" />
<android.support.v7.widget.AppCompatRadioButton
android:id="#+id/radio_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/radio_button_background"
android:button="#null"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.864"
app:layout_constraintStart_toEndOf="#+id/phone_number"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
This is my RecyclerView:
<android.support.v7.widget.RecyclerView
android:id="#+id/recyclerview"
android:layout_width="match_parent"
android:layout_height="100dp"
android:paddingTop="25dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/title" />
This is my layout i am unable to set left or start both text view and right or end side radio button inside constraint layout my current screen is below :
Here is the screen shot:
while i want check box full right side or end of constraint layout please suggest me ho to achieve this
Updated
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.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="wrap_content">
<android.support.v7.widget.AppCompatTextView
android:id="#+id/phone_number"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:fontFamily="sans-serif"
android:letterSpacing="0.01"
android:lineSpacingExtra="32sp"
android:text="+44 2079460860"
android:textColor="#color/colorPrimaryDark"
android:textSize="16sp"
android:textStyle="normal"
app:layout_constraintEnd_toStartOf="#id/radio_button"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<android.support.v7.widget.AppCompatTextView
android:id="#+id/name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:fontFamily="sans-serif"
android:text="Mobile UK"
android:textColor="#color/colorPrimary"
android:textSize="14sp"
android:textStyle="normal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="#id/radio_button"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/phone_number" />
<android.support.v7.widget.AppCompatRadioButton
android:id="#+id/radio_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
Try below code, change android.support.constraint.ConstraintLayout to LinearLayout and set layout weight.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_weight="1"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.AppCompatTextView
android:id="#+id/phone_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="sans-serif"
android:letterSpacing="0.01"
android:lineSpacingExtra="32sp"
android:text="+44 2079460860"
android:textColor="#color/colorPrimary"
android:textSize="16sp"
android:textStyle="normal"
/>
<android.support.v7.widget.AppCompatTextView
android:id="#+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="sans-serif"
android:lineSpacingExtra="32sp"
android:text="Mobile UK"
android:textColor="#color/colorAccent"
android:textSize="14sp"
android:textStyle="normal"
/>
</LinearLayout>
<LinearLayout
android:gravity="right"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<android.support.v7.widget.AppCompatRadioButton
android:id="#+id/radio_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#mipmap/ic_launcher"
android:button="#null"
/>
</LinearLayout>
</LinearLayout>
or, you can use below sample code :
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_weight="1"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Mobile UK"
android:textColor="#color/colorAccent"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="+44 2079460860"
android:textColor="#color/colorPrimary"
/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<RadioButton
android:id="#+id/radio_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</LinearLayout>

Categories

Resources