I'm trying to position a couple of buttons at the bottom of the page and have set their height to wrap_content, like so:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/fragment_container"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="#color/colorAccent"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.appbar.AppBarLayout
android:id="#+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/AppTheme.AppBarOverlay">
<androidx.appcompat.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="#style/AppTheme.PopupOverlay" />
</com.google.android.material.appbar.AppBarLayout>
<TextView
android:id="#+id/words_prompt"
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_below="#+id/appbar"
android:layout_margin="10dp"
android:text="#string/words_prompt" />
<EditText
android:id="#+id/word_list"
android:singleLine="false"
android:enabled="false"
android:lines="10"
android:textStyle="bold"
android:textColor="#color/colorPrimaryDark"
android:background="#ffffff"
android:inputType="textMultiLine"
android:layout_below="#+id/words_prompt"
android:layout_margin="10dp"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:gravity="top"
android:layout_width="180sp"
android:layout_height="wrap_content"/>
<TextView
android:id="#+id/time_left_prompt"
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="#+id/word_list"
android:layout_toEndOf="#+id/word_list"
android:layout_below="#+id/words_prompt"
android:layout_margin="10dp"
android:text="#string/time_left_prompt" />
<TextView
android:id="#+id/time_left"
android:textStyle="bold"
android:layout_below="#+id/words_prompt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="#+id/time_left_prompt"
android:layout_toEndOf="#+id/time_left_prompt"
android:layout_margin="10dp" />
<EditText
android:id="#+id/typed_word"
android:focusable="false"
android:maxLength="10"
android:inputType="text"
android:textCursorDrawable="#drawable/custom_cursor"
android:enabled="false"
android:layout_below="#+id/word_list"
android:digits="abcdefghijklmnopqrstuvwxyz"
android:textColor="#color/colorPrimaryDark"
android:layout_margin="10dp"
android:hint="#string/type_hint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<Button
android:id="#+id/done_button"
android:enabled="false"
android:text="#string/done_prompt"
android:layout_toRightOf="#+id/typed_word"
android:layout_toEndOf="#+id/typed_word"
android:layout_alignBaseline="#+id/typed_word"
android:layout_below="#+id/word_list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<include
layout="#layout/keyboardlayout_en"
android:id="#+id/keyboard_layout"
android:visibility="invisible"
android:layout_centerInParent="true"
android:layout_marginTop="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/done_button"/>
<Button
android:id="#+id/start_timer_button"
android:text="#string/start_timer_prompt"
android:layout_margin="10dp"
android:layout_below="#+id/done_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:id="#+id/best_score_prompt"
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/start_timer_button"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:text="#string/best_score_prompt" />
<TextView
android:id="#+id/best_score"
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/start_timer_button"
android:layout_toRightOf="#+id/best_score_prompt"
android:layout_toEndOf="#+id/best_score_prompt"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_marginRight="10dp"
android:layout_marginEnd="10dp" />
<TextView
android:id="#+id/elapsed_time_prompt"
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="invisible"
android:layout_below="#+id/best_score_prompt"
android:layout_margin="10dp"
android:text="#string/elapsed_time_prompt" />
<TextView
android:id="#+id/elapsed_time"
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="invisible"
android:layout_below="#+id/best_score_prompt"
android:layout_toRightOf="#+id/elapsed_time_prompt"
android:layout_toEndOf="#+id/elapsed_time_prompt"
android:layout_margin="10dp" />
<Button
android:id="#+id/reset_button"
android:text="#string/reset_prompt"
android:enabled="false"
android:layout_alignParentBottom="true"
android:layout_below="#+id/best_score_prompt"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Button
android:id="#+id/quit_button"
android:text="#string/quit_prompt"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_below="#+id/best_score_prompt"
android:layout_marginRight="10dp"
android:layout_marginEnd="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</RelativeLayout>
But the layout renders as this:
Why are the heights so off and what do I need to do to fix this (without hard-coding the button height with numbers or adding top margins)?
Remove in both buttons:
android:layout_below="#+id/best_score_prompt"
With:
Without:
Related
I have a View in my activity where it contains one image, a text and a button...
So as you can see my button is showing there but its not visible...
It is going behind, I have tried to test it by marginTop attribute and if I move it down from the view then its visible...
I don't know how to do this but with the TextView when I use background then it changes the background color & works fine..
But I want to use Button instead of TextView
How can I do this or what I will have to do to bring the button front?
Below is my xml file code
<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView 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=".Dashboard">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<View
android:id="#+id/view"
android:layout_width="match_parent"
android:layout_height="250dp"
android:background="#drawable/dashboard_layout"
android:elevation="6dp"
android:transitionName="bg_anim"
android:layout_alignParentTop="true"
/>
<androidx.appcompat.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:elevation="6dp"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<!--This is the button-->
<!--Removed <Button
android:id="#+id/tv_welcome"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:backgroundTint="#color/black"
android:elevation="6dp"
android:text="Hello,"
android:textColor="#fff"
android:textSize="35sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/toolbar" />
-->
<--added newly-->
<Button
android:id="#+id/tv_welcome"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:backgroundTint="#color/black"
android:elevation="6dp"
android:text="Hello,"
android:textColor="#fff"
android:textSize="35sp"
android:layout_alignParentStart="true"
android:layout_below="#+id/toolbar"/>
<TextView
android:id="#+id/tv_username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:elevation="6dp"
android:text="Username"
android:textColor="#B2FFFFFF"
android:textSize="22sp"
android:transitionName="user_anim"
app:layout_constraintStart_toStartOf="#+id/tv_welcome"
app:layout_constraintTop_toTopOf="#+id/guideline3" />
<ImageView
android:id="#+id/iv_display_image"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_marginTop="10dp"
android:elevation="6dp"
android:padding="8dp"
android:transitionName="profile_anim"
android:layout_centerHorizontal="true"
app:layout_constraintDimensionRatio="h,1:1"
app:srcCompat="#drawable/ic_undraw_male_avatar" />
<TextView
android:id="#+id/tv_dashboard"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="48dp"
android:layout_marginTop="16dp"
android:text="Your Dashboard"
android:textColor="#ff1122"
android:textSize="20sp"
android:layout_below="#+id/view"/>
</RelativeLayout>
</androidx.core.widget.NestedScrollView>
After changing some code...
You are using RelativeLayout as parent and adding constraints to Button which only works when the parent is ConstraintLayout, to achieve same in RelativeLayout try android:layout_alignParentStart="true" and android:layout_below="#+id/toolbar" as in
<Button
android:id="#+id/tv_welcome"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:backgroundTint="#color/black"
android:elevation="6dp"
android:text="Hello,"
android:textColor="#fff"
android:textSize="35sp"
android:layout_alignParentStart="true"
android:layout_below="#+id/toolbar" />
Also remove elevation on View as it is just setting background
<View
android:id="#+id/view"
android:layout_width="match_parent"
android:layout_height="250dp"
android:background="#drawable/dashboard_layout"
android:transitionName="bg_anim"
android:layout_alignParentTop="true"/>
<RelativeLayout 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">
<RelativeLayout
android:id="#+id/layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="#+id/header_cover_image"
android:layout_width="match_parent"
android:layout_height="200dp"
android:background="#drawable/my_gradient_background"
android:orientation="vertical"
android:scaleType="centerCrop"
/>
<ImageView
android:id="#+id/profile"
android:layout_width="200dp"
android:layout_height="200dp"
android:layout_below="#+id/header_cover_image"
android:layout_centerHorizontal="true"
android:layout_marginTop="-150dp"
android:clickable="true"
android:elevation="5dp"
android:padding="20dp"
android:scaleType="centerCrop"
android:src="#drawable/app_icon"
app:civ_border_color="#FFFFFFFF"
app:civ_border_width="3dp" />
<RelativeLayout
android:id="#+id/profile_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/header_cover_image"
android:layout_marginLeft="10dp"
android:layout_marginTop="-50dp"
android:layout_marginRight="10dp"
android:background="#drawable/white_rounded_corner"
android:elevation="4dp"
android:paddingBottom="24dp">
<ImageView
android:id="#+id/save_profile"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:visibility="gone"
android:layout_marginRight="20dp"
android:clickable="true"
android:src="#android:drawable/ic_menu_save" />
<ImageView
android:id="#+id/edit_profile"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_marginRight="20dp"
android:clickable="true"
android:src="#android:drawable/ic_menu_edit" />
<EditText
android:id="#+id/user_name_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="90dp"
android:background="#android:color/transparent"
android:inputType="none"
android:ems="50"
android:ellipsize="end"
android:focusable="false"
android:gravity="center"
android:maxLines="1"
android:text="Laxman Marothiya"
android:textColor="#000"
android:textSize="#dimen/normal_subTitle_font_size_eighteen"
android:textStyle="bold" />
<EditText
android:id="#+id/gender_info_textv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/user_name_info"
android:layout_centerHorizontal="true"
android:background="#android:color/transparent"
android:inputType="none"
android:focusable="false"
android:gravity="center"
android:ems="6"
android:maxLines="1"
android:text="Male"
android:textColor="#000"
android:textSize="#dimen/normal_subTitle_font_size_eighteen" />
<EditText
android:id="#+id/email_info_textv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/gender_info_textv"
android:layout_centerHorizontal="true"
android:background="#android:color/transparent"
android:inputType="none"
android:focusable="false"
android:gravity="center"
android:ems="40"
android:maxLines="1"
android:text="Emaol#gmail.com"
android:textColor="#000"
android:textSize="#dimen/normal_text_size_fifteen" />
<EditText
android:id="#+id/bio_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/email_info_textv"
android:layout_centerHorizontal="true"
android:layout_margin="5dp"
android:background="#android:color/transparent"
android:inputType="none"
android:focusable="false"
android:gravity="center"
android:padding="8dp"
android:ellipsize="end"
android:ems="200"
android:text="Here is my bio can you see it actually this is very interesting here "
android:textColor="#color/appBlackColor"
android:textSize="#dimen/normal_text_size_fifteen" />
</RelativeLayout>
</RelativeLayout>
I have layout for my activity and it shows up everything besides two edittexts, here it is.
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true">
<RelativeLayout 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="com.example.hrle.androidapp.activity.ReadPostActivity"
android:id="#+id/arp">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar_rp"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="#color/colorAccent"
android:theme="#style/Theme.AppCompat.Light.NoActionBar"
/>
<ImageView
android:id="#+id/slika"
android:layout_width="220dp"
android:layout_height="141dp"
android:layout_below="#+id/naslov"
android:layout_marginEnd="5dp"
android:layout_toStartOf="#id/autor"
app:srcCompat="#mipmap/ic_launcher" />
<TextView
android:id="#+id/naslov"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="60dp"
android:textAlignment="center"
android:textSize="40dp" />
<TextView
android:id="#+id/autor"
android:layout_width="190dp"
android:layout_height="48dp"
android:layout_alignParentEnd="true"
android:layout_below="#+id/naslov"
android:text="Autor: "
android:textSize="12sp" />
<TextView
android:id="#+id/datum"
android:layout_width="190dp"
android:layout_height="42dp"
android:layout_alignParentEnd="true"
android:layout_below="#+id/autor"
android:text="Datum: "
android:textSize="12sp" />
<TextView
android:id="#+id/lokacija"
android:layout_width="190dp"
android:layout_height="42dp"
android:layout_below="#+id/datum"
android:layout_alignParentEnd="true"
android:text="Lokacija: "
android:textSize="12sp" />
<TextView
android:id="#+id/likes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="100dp"
android:layout_below="#+id/opis"
android:drawableLeft="#drawable/ic_like"
/>
<TextView
android:id="#+id/dislikes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toEndOf="#id/likes"
android:layout_marginStart="30dp"
android:layout_below="#id/opis"
android:drawableStart="#drawable/ic_dislike" />
<TextView
android:id="#+id/opis"
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_alignParentStart="true"
android:layout_below="#+id/slika"
android:background="#drawable/border"
/>
<EditText
android:id="#+id/naslov_za_unos"
android:layout_width="200dp"
android:layout_height="50dp"
android:layout_above="#id/lv_comments"
android:layout_below="#id/likes"
android:hint="Unesite naslov"
android:inputType="text"/>
<EditText
android:id="#+id/opis_za_unos"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#id/lv_comments"
android:layout_below="#id/naslov_za_unos"
android:hint="Unesite opis"
android:inputType="text"
/>
<Button
android:id="#+id/dugme_potvrde_kom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/dislikes"
android:layout_alignParentEnd="true"
android:layout_marginTop="30dp"
android:layout_marginEnd="100dp"
android:text="Objavi"
/>
<android.support.v7.widget.RecyclerView
android:id="#+id/lv_comments"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/likes"
android:layout_marginTop="100dp"
/>
</RelativeLayout>
</ScrollView>
Here is the picture of design, edittexts should show up on position which I marked on picture. Can anyone figure out what makes it not show? And yes, I did everything in activity(findViewById etc.)
https://imgur.com/EltSZbi
Replace your code with these lines of code, I have used the LinearLayout for your view alignment, have a look in below solution
<RelativeLayout 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/arp"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.hrle.androidapp.activity.ReadPostActivity">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar_rp"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="#color/colorAccent"
android:theme="#style/Theme.AppCompat.Light.NoActionBar"
/>
<ImageView
android:id="#+id/slika"
android:layout_width="220dp"
android:layout_height="141dp"
android:layout_below="#+id/naslov"
android:layout_marginEnd="5dp"
android:layout_toStartOf="#id/autor"
app:srcCompat="#mipmap/ic_launcher" />
<TextView
android:id="#+id/naslov"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="60dp"
android:textAlignment="center"
android:textSize="40dp" />
<TextView
android:id="#+id/autor"
android:layout_width="190dp"
android:layout_height="48dp"
android:layout_alignParentEnd="true"
android:layout_below="#+id/naslov"
android:text="Autor: "
android:textSize="12sp" />
<TextView
android:id="#+id/datum"
android:layout_width="190dp"
android:layout_height="42dp"
android:layout_alignParentEnd="true"
android:layout_below="#+id/autor"
android:text="Datum: "
android:textSize="12sp" />
<TextView
android:id="#+id/lokacija"
android:layout_width="190dp"
android:layout_height="42dp"
android:layout_alignParentEnd="true"
android:layout_below="#+id/datum"
android:text="Lokacija: "
android:textSize="12sp" />
<TextView
android:id="#+id/likes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/opis"
android:layout_marginStart="100dp"
android:drawableLeft="#drawable/ic_like"
/>
<TextView
android:id="#+id/dislikes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/opis"
android:layout_marginStart="30dp"
android:layout_toEndOf="#id/likes"
android:drawableStart="#drawable/ic_dislike"
/>
<TextView
android:id="#+id/opis"
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_alignParentStart="true"
android:layout_below="#+id/slika"
android:background="#mipmap/ic_launcher" />
<LinearLayout
android:id="#+id/ll_input"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/dislikes"
android:gravity="center"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<EditText
android:id="#+id/naslov_za_unos"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_above="#id/lv_comments"
android:layout_below="#id/likes"
android:hint="Unesite naslov"
android:inputType="text" />
<EditText
android:id="#+id/opis_za_unos"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#id/lv_comments"
android:layout_below="#id/naslov_za_unos"
android:hint="Unesite opis"
android:inputType="text" />
</LinearLayout>
<Button
android:id="#+id/dugme_potvrde_kom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/dislikes"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_weight="1"
android:gravity="center"
android:text="Objavi"
/>
</LinearLayout>
<android.support.v7.widget.RecyclerView
android:id="#+id/lv_comments"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/ll_input"
android:layout_marginTop="10dp" />
</RelativeLayout>
Try this:
<EditText
android:id="#+id/naslov_za_unos"
android:layout_width="200dp"
android:layout_height="50dp"
android:layout_above="#id/opis_za_unos"
android:layout_below="#id/likes"
android:layout_alignParentStart = true
android:hint="Unesite naslov"
android:inputType="text"
/>
<EditText
android:id="#+id/opis_za_unos"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#id/lv_comments"
android:layout_below="#id/naslov_za_unos"
android:layout_alignParentStart = true
android:hint="Unesite opis"
android:inputType="text"
/>
Im trying to put a TextView below a multiline EditText and if the EditText starts to grow in height the TextView needs to stay below the EditText, right now if the EditText starts to grow it just covers the TextView below, they are inside a RelativeLayout. Here is the XML of the two objects:
<EditText
android:id="#+id/descripcion_actividad"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/descripcion_actividad_label"
android:layout_alignBottom="#+id/descripcion_actividad_label"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_toEndOf="#+id/cantidad"
android:layout_toRightOf="#+id/cantidad"
android:ems="10"
android:inputType="textMultiLine" />
<TextView
android:id="#+id/hora_inicio"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/descripcion_actividad"
android:layout_alignParentBottom="false"
android:layout_below="#+id/descripcion_actividad"
android:layout_alignStart="#+id/descripcion_actividad"
android:text="TextView" />
EDIT: Whole layout:
<RelativeLayout 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/activity_third_form_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="dbxprts.terminaltrak.PlanTrabajoActivity">
<android.support.v7.widget.Toolbar
android:id="#+id/my_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:elevation="4dp"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light"
app:theme="#style/ToolBarStyle" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/my_toolbar"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="#+id/activity_third_form"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context="dbxprts.terminaltrak.PlanTrabajoActivity">
<Spinner
android:id="#+id/liberado_rechazado"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/tipo_fase"
android:layout_alignStart="#+id/tipo_fase"
android:layout_below="#+id/tipo_fase"
android:layout_marginTop="5dp"
android:entries="#array/array_liberado_rechazado"
android:visibility="gone" />
<Spinner
android:id="#+id/id_cliente"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/id_cliente_label"
android:layout_marginLeft="35dp"
android:layout_toEndOf="#+id/id_realizo_label"
android:layout_toRightOf="#+id/id_realizo_label" />
<TextView
android:id="#+id/hora_inicio"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/descripcion_actividad"
android:layout_alignParentBottom="false"
android:layout_alignStart="#+id/descripcion_actividad"
android:layout_below="#+id/descripcion_actividad"
android:layout_marginTop="20dp"
android:text="TextView" />
<TextView
android:id="#+id/descripcion_actividad_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="#+id/id_cliente_label"
android:layout_marginTop="35dp"
android:text="Descripción Actividad:" />
<TextView
android:id="#+id/id_cliente_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="#+id/id_operacion_label"
android:layout_marginTop="35dp"
android:text="ID Cliente:" />
<Spinner
android:id="#+id/id_operacion"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/id_operacion_label"
android:layout_marginLeft="25dp"
android:layout_toEndOf="#+id/id_operacion_label"
android:layout_toRightOf="#+id/id_operacion_label" />
<Spinner
android:id="#+id/id_supervisor"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/id_supervisor_label"
android:layout_marginLeft="25dp"
android:layout_toEndOf="#+id/id_supervisor_label"
android:layout_toRightOf="#+id/id_supervisor_label" />
<TextView
android:id="#+id/id_operacion_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="#+id/cantidad_label"
android:layout_marginTop="35dp"
android:text="ID Operación:" />
<EditText
android:id="#+id/cantidad"
android:layout_width="70dp"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/cantidad_label"
android:layout_alignBottom="#+id/cantidad_label"
android:layout_toEndOf="#+id/id_supervisor_label"
android:layout_toRightOf="#+id/id_supervisor_label"
android:ems="10"
android:inputType="number" />
<TextView
android:id="#+id/cantidad_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="#+id/id_supervisor_label"
android:layout_centerVertical="true"
android:layout_marginTop="35dp"
android:text="Cantidad:" />
<TextView
android:id="#+id/id_programo_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="#+id/tipo_fase_label"
android:layout_marginTop="35dp"
android:text="ID Programó:"
android:textSize="15sp" />
<Spinner
android:id="#+id/tipo_fase"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/tipo_fase_label"
android:layout_marginLeft="25dp"
android:layout_toEndOf="#+id/id_plan_label"
android:layout_toRightOf="#+id/id_plan_label"
android:dropDownWidth="match_parent"
android:minWidth="100dip" />
<TextView
android:id="#+id/id_supervisor_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="#+id/id_realizo_label"
android:layout_marginTop="35dp"
android:text="ID Supervisor:" />
<Spinner
android:id="#+id/spinner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/id_realizo_label"
android:layout_alignLeft="#+id/tipo_fase"
android:layout_alignStart="#+id/tipo_fase"
android:layout_marginLeft="25dp" />
<Button
android:id="#+id/confirmar_cambios"
android:layout_width="120dp"
android:layout_height="55dp"
android:layout_alignParentBottom="true"
android:layout_below="#+id/descarga_cronometro"
android:layout_centerHorizontal="true"
android:elevation="0dp"
android:text="Registrar Fase"
android:textAllCaps="false"
android:visibility="gone" />
<TextView
android:id="#+id/hora_inicio_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignTop="#+id/hora_inicio"
android:text="Hora Inicio:" />
<Spinner
android:id="#+id/via"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/id_programo_label"
android:layout_marginLeft="25dp"
android:layout_toEndOf="#+id/id_programo_label"
android:layout_toRightOf="#+id/id_programo_label" />
<TextView
android:id="#+id/tipo_fase_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="#+id/id_plan_label"
android:layout_marginTop="35dp"
android:layout_toLeftOf="#+id/tipo_fase"
android:layout_toStartOf="#+id/tipo_fase"
android:text="Tipo Fase:"
android:textSize="15sp" />
<TextView
android:id="#+id/id_plan_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:text="ID Plan Label:"
android:textSize="15sp" />
<EditText
android:id="#+id/descripcion_actividad"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/descripcion_actividad_label"
android:layout_alignBottom="#+id/descripcion_actividad_label"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_toEndOf="#+id/cantidad"
android:layout_toRightOf="#+id/cantidad"
android:ems="10"
android:inputType="textMultiLine" />
<TextView
android:id="#+id/id_realizo_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="#+id/id_programo_label"
android:layout_marginTop="35dp"
android:text="ID Realizó:" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>
Place the EditText and Textview inside a LinearLayout with orientation as vertical
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/rootLinearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<EditText
android:id="#+id/descripcion_actividad"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
--------------------------
--------------------------
android:inputType="textMultiLine" />
<TextView
android:id="#+id/hora_inicio"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
--------------------------
--------------------------
android:text="TextView" />
</LinearLayout>
Use a Linearlayout instead .
<LinearLayout
android:layout_width="wrap_content"
android:orientation="vertical"
android:gravity="center_horizontal"
android:layout_height="wrap_content">
<EditText
android:id="#+id/descripcion_actividad"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textMultiLine" />
<TextView
android:id="#+id/hora_inicio"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView" />
</LinearLayout>
OR With Relative Layout use
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<EditText
android:id="#+id/descripcion_actividad"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:ems="10"
android:inputType="textMultiLine" />
<TextView
android:id="#+id/hora_inicio"
android:layout_width="wrap_content"
android:layout_centerHorizontal="true"
android:layout_height="wrap_content"
android:layout_below="#+id/descripcion_actividad"
android:text="TextView" />
</RelativeLayout>
I have a RelativeLayout on top of a LinearLayout. The LinearLayout has a background image. I want to make the RelativeLayout transparent nicely.
I've used the alpha attribute, but the desired effect is not achieved.
Here's the effect of alpha attribute.
What I want is for the background image to be visible throughout the Activity in the background. Here's the original look that needs to be changed.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
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="#drawable/green_bg"
android:orientation="vertical"
tools:context="com.example.android.test4.MainActivity">
<android.support.v7.widget.Toolbar
android:id="#+id/my_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:elevation="4dp"
app:titleTextColor="#color/white" />
<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/cardview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:animateLayoutChanges="true"
android:orientation="horizontal"
card_view:cardCornerRadius="5dp"
card_view:cardElevation="5dp"
tools:context="com.example.android.test2.MainActivity">
<RelativeLayout
android:id="#+id/relLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="#color/white"
android:weightSum="1">
<ImageView
android:id="#+id/movieImage"
android:layout_width="166dp"
android:layout_height="88dp"
android:layout_alignLeft="#+id/imageView12"
android:layout_alignStart="#+id/imageView12"
android:layout_below="#+id/imageView12"
android:layout_marginTop="19dp"
android:layout_weight="0.05"
android:padding="10dp"
android:src="#drawable/defaultimgg" />
<Button
android:id="#+id/reject"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_toEndOf="#+id/accept"
android:layout_toRightOf="#+id/accept"
android:background="#color/btn_login_bg"
android:text="Reject"
android:textColor="#color/btn_login" />
<Button
android:id="#+id/accept"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/movieImage"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignRight="#+id/movieImage"
android:background="#color/btn_login_bg"
android:text="accept"
android:textColor="#color/btn_login" />
<TextView
android:id="#+id/idTxt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
tools:text="idTxt" />
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/movieImage"
android:layout_alignStart="#+id/movieImage"
android:layout_below="#+id/idTxt"
android:layout_marginTop="22dp"
android:text="Type Of Serves : "
tools:text="textView5" />
<TextView
android:id="#+id/txttypeofserves"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/textView5"
android:layout_toEndOf="#+id/textView5"
android:layout_toRightOf="#+id/textView5"
android:text="TextView"
tools:text="txttypeofserves" />
<TextView
android:id="#+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView5"
android:layout_alignStart="#+id/textView5"
android:layout_below="#+id/textView5"
android:layout_marginTop="30dp"
android:layout_toLeftOf="#+id/txttypeofserves"
android:layout_toStartOf="#+id/txttypeofserves"
android:text="Addres : "
tools:text="Address" />
<TextView
android:id="#+id/txtaddres"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView7"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignStart="#+id/textView7"
android:layout_below="#+id/textView7"
android:text="TextView"
tools:text="txtaddress" />
<TextView
android:id="#+id/textView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/txtaddres"
android:layout_alignStart="#+id/txtaddres"
android:layout_below="#+id/txtaddres"
android:layout_marginTop="18dp"
android:text="Date: "
tools:text="Date" />
<TextView
android:id="#+id/txtdate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/textView9"
android:layout_toEndOf="#+id/textView9"
android:layout_toRightOf="#+id/textView9"
android:text="TextView"
tools:text="txtdate" />
<TextView
android:id="#+id/textView11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/txtdate"
android:layout_centerHorizontal="true"
android:text="Time : "
tools:text="time" />
<TextView
android:id="#+id/txttime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/textView11"
android:layout_toEndOf="#+id/textView11"
android:layout_toRightOf="#+id/textView11"
android:text="TextView"
tools:text="txttime" />
<ImageView
android:id="#+id/imageView12"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_below="#+id/txttype1"
android:layout_marginLeft="14dp"
android:layout_marginStart="14dp"
android:layout_marginTop="27dp"
android:layout_toEndOf="#+id/idTxt"
android:layout_toRightOf="#+id/idTxt"
android:src="#drawable/defaultimgg" />
<TextView
android:id="#+id/txtrectype"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView9"
android:layout_alignStart="#+id/textView9"
android:layout_below="#+id/textView9"
android:layout_marginTop="25dp"
android:text="TextView"
tools:text="txtrectype" />
<TextView
android:id="#+id/txttype1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/imageView12"
android:layout_alignStart="#+id/imageView12"
android:layout_below="#+id/txtrectype"
android:layout_marginTop="28dp"
android:text="TextView"
tools:text="txtype1" />
<TextView
android:id="#+id/txttotalloadingfee"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/imageView12"
android:layout_toEndOf="#+id/imageView12"
android:layout_toRightOf="#+id/imageView12"
android:text="TextView"
tools:text="txttoatlloadingfree" />
</RelativeLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
I already have seen in the comment that you've tweaked the alpha attribute to make it work. But anyway, as far as I have understood from your question you want to make your CardView to be transparent. So you might consider setting the background colour of your CardView as transparent by adding the following attribute in your CardView.
card_view:cardBackgroundColor="#android:color/transparent"
So the final CardView should look like this.
<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/cardview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:animateLayoutChanges="true"
android:orientation="horizontal"
card_view:cardCornerRadius="5dp"
card_view:cardElevation="5dp"
card_view:cardBackgroundColor="#android:color/transparent"
tools:context="com.example.android.test2.MainActivity">
<!-- Other UI elements here -->
</CardView>
I got your problem if you set an alpha then text also become transparent and here i found solution ..paste below code it working find i put one more relative layout only for background and i make cardview and main relative become transparent so adjust alpha in relLayoutextra layout.....
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
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="#android:color/holo_green_dark"
android:orientation="vertical"
tools:context="com.example.android.test4.MainActivity">
<android.support.v7.widget.Toolbar
android:id="#+id/my_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:elevation="4dp"
app:titleTextColor="#color/white" />
<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/cardview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:animateLayoutChanges="true"
android:orientation="horizontal"
card_view:cardCornerRadius="5dp"
card_view:cardElevation="5dp"
card_view:cardBackgroundColor="#android:color/transparent"
tools:context="com.example.android.test2.MainActivity">
<RelativeLayout
android:id="#+id/relLayoutextra"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:background="#android:color/white"
android:alpha="0.5"
android:weightSum="1">
</RelativeLayout>
<RelativeLayout
android:id="#+id/relLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="#android:color/transparent"
android:weightSum="1">
<ImageView
android:id="#+id/movieImage"
android:layout_width="166dp"
android:layout_height="88dp"
android:layout_alignLeft="#+id/imageView12"
android:layout_alignStart="#+id/imageView12"
android:layout_below="#+id/imageView12"
android:layout_marginTop="19dp"
android:layout_weight="0.05"
android:padding="10dp"
android:src="#drawable/defaultimgg" />
<Button
android:id="#+id/reject"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_toEndOf="#+id/accept"
android:layout_toRightOf="#+id/accept"
android:background="#color/btn_login_bg"
android:text="Reject"
android:textColor="#color/btn_login" />
<Button
android:id="#+id/accept"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/movieImage"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignRight="#+id/movieImage"
android:background="#color/btn_login_bg"
android:text="accept"
android:textColor="#color/btn_login" />
<TextView
android:id="#+id/idTxt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
tools:text="idTxt" />
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/movieImage"
android:layout_alignStart="#+id/movieImage"
android:layout_below="#+id/idTxt"
android:layout_marginTop="22dp"
android:text="Type Of Serves : "
tools:text="textView5" />
<TextView
android:id="#+id/txttypeofserves"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/textView5"
android:layout_toEndOf="#+id/textView5"
android:layout_toRightOf="#+id/textView5"
android:text="TextView"
tools:text="txttypeofserves" />
<TextView
android:id="#+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView5"
android:layout_alignStart="#+id/textView5"
android:layout_below="#+id/textView5"
android:layout_marginTop="30dp"
android:layout_toLeftOf="#+id/txttypeofserves"
android:layout_toStartOf="#+id/txttypeofserves"
android:text="Addres : "
tools:text="Address" />
<TextView
android:id="#+id/txtaddres"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView7"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignStart="#+id/textView7"
android:layout_below="#+id/textView7"
android:text="TextView"
tools:text="txtaddress" />
<TextView
android:id="#+id/textView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/txtaddres"
android:layout_alignStart="#+id/txtaddres"
android:layout_below="#+id/txtaddres"
android:layout_marginTop="18dp"
android:text="Date: "
tools:text="Date" />
<TextView
android:id="#+id/txtdate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/textView9"
android:layout_toEndOf="#+id/textView9"
android:layout_toRightOf="#+id/textView9"
android:text="TextView"
tools:text="txtdate" />
<TextView
android:id="#+id/textView11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/txtdate"
android:layout_centerHorizontal="true"
android:text="Time : "
tools:text="time" />
<TextView
android:id="#+id/txttime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/textView11"
android:layout_toEndOf="#+id/textView11"
android:layout_toRightOf="#+id/textView11"
android:text="TextView"
tools:text="txttime" />
<ImageView
android:id="#+id/imageView12"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_below="#+id/txttype1"
android:layout_marginLeft="14dp"
android:layout_marginStart="14dp"
android:layout_marginTop="27dp"
android:layout_toEndOf="#+id/idTxt"
android:layout_toRightOf="#+id/idTxt"
android:src="#drawable/defaultimgg" />
<TextView
android:id="#+id/txtrectype"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView9"
android:layout_alignStart="#+id/textView9"
android:layout_below="#+id/textView9"
android:layout_marginTop="25dp"
android:text="TextView"
tools:text="txtrectype" />
<TextView
android:id="#+id/txttype1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/imageView12"
android:layout_alignStart="#+id/imageView12"
android:layout_below="#+id/txtrectype"
android:layout_marginTop="28dp"
android:text="TextView"
tools:text="txtype1" />
<TextView
android:id="#+id/txttotalloadingfee"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/imageView12"
android:layout_toEndOf="#+id/imageView12"
android:layout_toRightOf="#+id/imageView12"
android:text="TextView"
tools:text="txttoatlloadingfree" />
</RelativeLayout>
</android.support.v7.widget.CardView>
I have my xml file. It is a RelativeLayout with a ScrollView and inside the ScrollView I have LinearLayout and many more. The problem is that I can't reach the end of the view, as you can see it end with a "Sign Up" button... But my view is cut by the scroll and I can just see the middle of the button, the other middle is off screen.
So, any suggestions for how can I fix this? How can I work with the ScrollView so it wraps all of my content...
Check it:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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="wrap_content"
android:background="#drawable/bg_signup"
android:orientation="vertical"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context=".SignUp">
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="25dp"
android:background="#xml/signup_round">
<LinearLayout
android:layout_width="260dp"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#xml/border_lines"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/new_signup" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:text="#string/signup"
android:textColor="#color/colorRB"
android:textSize="26sp"
android:textStyle="bold" />
</LinearLayout>
<EditText
android:id="#+id/first_name_EditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:layout_marginTop="-25dp"
android:hint="#string/first_name"
android:textColor="#color/colorRB" />
<EditText
android:id="#+id/last_name_EditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:hint="#string/last_name"
android:textColor="#color/colorRB" />
<EditText
android:id="#+id/email_EditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:hint="#string/email"
android:inputType="textEmailAddress"
android:textColor="#color/colorRB" />
<EditText
android:id="#+id/email_confirmation_EditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:hint="#string/email_confirmation"
android:inputType="textEmailAddress"
android:textColor="#color/colorRB" />
<EditText
android:id="#+id/password_EditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:hint="#string/password"
android:inputType="textPassword"
android:textColor="#color/colorRB" />
<EditText
android:id="#+id/password_confirmation_EditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:hint="#string/password_confirmation"
android:inputType="textPassword"
android:textColor="#color/colorRB" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#xml/border_lines"
android:text="#string/sex"
android:textColor="#color/colorRB"
android:textSize="26sp"
android:textStyle="bold" />
<Spinner
android:id="#+id/sex_spinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="-25dp"
android:entries="#array/sex_array" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#xml/border_lines"
android:text="#string/brithday"
android:textColor="#color/colorRB"
android:textSize="26sp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="-35dp"
android:orientation="horizontal">
<Button
android:id="#+id/birthdayBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:background="#color/fbutton_color_transparent"
android:onClick="showDatePickerDialog"
android:text="#string/birthdayBtn"
android:textAllCaps="false"
android:textColor="#color/colorRB" />
<Space
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1" />
<TextView
android:id="#+id/dateSelectedTv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:text="--/--/--"
android:textColor="#color/colorRB"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:paddingBottom="5dp"
android:text="#string/terms_conditions"
android:textColor="#color/colorRB"
android:textStyle="bold" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0" />
</LinearLayout>
<Button
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="5dp"
android:background="#xml/button_round"
android:onClick=""
android:text="#string/signup"
android:textColor="#color/white"
android:textStyle="bold" />
</LinearLayout>
</RelativeLayout>
</ScrollView>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick=""
android:src="#drawable/close_signup" />
</RelativeLayout>