CardView height doesn't transition with nested RecyclerView - java

I have a nested RecyclerView in which the parent view is a CardView ( gif ). I'm trying to implement a swipe to delete action by Paul Burke ( link ). The action transitions nicely within the inner RecyclerView, but causes the outer CardView's height (wrap_content) to jump. Is there a way to make the CardView transition with the RecyclerView?
Inner RecyclerView:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/card_tasks_root"
android:orientation="vertical"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/card_tasks_title"
android:padding="8dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="section placeholder" />
<android.support.v7.widget.CardView
android:layout_marginBottom="5dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#fff"
android:elevation="2dp">
<android.support.v7.widget.RecyclerView
android:id="#+id/card_tasks_rv"
android:background="#E0E0E0"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</android.support.v7.widget.CardView>
</LinearLayout>
Inner Item:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:background="#fff"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:orientation="vertical"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="7dp"
android:paddingBottom="5dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/item_task_project"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="12sp"
tools:text="Project name"
/>
<TextView
android:id="#+id/item_task_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="3dp"
android:paddingBottom="5dp"
android:textSize="18dp"
android:textColor="#757575"
tools:text="Task name"/>
</LinearLayout>
<View android:id="#+id/item_task_divider" style="#style/Divider"/>
</LinearLayout>

Set the CardView as the parent in your item layout, and have that load into your RecyclerView, like this:
Your container:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/card_tasks_root"
android:orientation="vertical"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/card_tasks_title"
android:padding="8dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="section placeholder" />
<android.support.v7.widget.RecyclerView
android:id="#+id/card_tasks_rv"
android:background="#E0E0E0"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
Inner item:
<android.support.v7.widget.CardView
android:layout_marginBottom="5dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#fff"
android:elevation="2dp">
<LinearLayout
android:orientation="vertical"
android:background="#fff"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:orientation="vertical"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="7dp"
android:paddingBottom="5dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/item_task_project"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="12sp"
tools:text="Project name"
/>
<TextView
android:id="#+id/item_task_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="3dp"
android:paddingBottom="5dp"
android:textSize="18dp"
android:textColor="#757575"
tools:text="Task name"/>
</LinearLayout>
<View android:id="#+id/item_task_divider" style="#style/Divider"/>
</LinearLayout>
</android.support.v7.widget.CardView>

Related

I'm making a mistake somewhere while making a simple design

no matter what I do in my design, I want to center what I wrote with the photographs, but I cannot do the design, I wonder where I am going wrong I'm learning new and tried to make a design like in the photo
I'll create the rest using the recycler view and card view
Enough explanation, I hope I don't want to confuse you
<androidx.cardview.widget.CardView 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">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="#+id/imageView6"
android:layout_width="60dp"
android:layout_height="60dp"
android:contentDescription="TODO" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="#+id/textView4"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="text" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="#+id/textView5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Date" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal">
<TextView
android:id="#+id/textView3"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="text" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="#+id/imageView7"
android:layout_width="60dp"
android:layout_height="60dp"" />
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
Splitted the center part to two linear layouts. Also added android:gravity="center|bottom" to the TextView which contains the date.
<androidx.cardview.widget.CardView 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">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="#+id/imageView6"
android:layout_width="60dp"
android:layout_height="60dp"
android:contentDescription="TODO" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="text" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="text" />
</LinearLayout>
<TextView
android:id="#+id/textView5"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center|bottom"
android:text="Date" />
</LinearLayout>
<ImageView
android:id="#+id/imageView7"
android:layout_width="60dp"
android:layout_height="60dp" />
</LinearLayout> </androidx.cardview.widget.CardView>
Here's how it looks like. I added some colors so it's easier to see where layouts begin and end. The colors are not part of the xml.

ScrollView top part is cut off when I added adjustPan so keyboard won't overlap EditText

I have a ScrollView (with a RecyclerView inside) and a RelativeLayout after it which contains EditText. I added
android:windowSoftInputMode="stateAlwaysHidden|adjustPan"
for the activity in my manifest file because my keyboard overlaps the EditText but in effect, whenever the keyboard is active, the top part of my ScrollView is cut off.
I have tried using NestedScrollView and setting RelativeLayout android:layout_height="wrap_content" and android:layout_gravity="center" but that doesn't work. Below is the snippet of my code:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/adView"
android:layout_alignParentTop="true"
android:background="#android:color/white"
android:scrollbars="vertical">
<RelativeLayout
...
</RelativeLayout>
<ScrollView
android:id="#+id/news_comments"
android:fillViewport="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/rl_title">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/individual_news_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="5dp"
android:orientation="vertical">
// some other layouts
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/individual_news_item"
android:orientation="vertical"
android:paddingEnd="15dp"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:paddingStart="15dp"
android:paddingTop="15dp">
<android.support.v7.widget.RecyclerView
android:id="#+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="15dp" />
</LinearLayout>
</LinearLayout>
</ScrollView>
<RelativeLayout
android:id="#+id/ll_message_actions"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:focusable="true"
android:focusableInTouchMode="true"
android:orientation="vertical"
android:layout_gravity="center">
<LinearLayout
android:id="#+id/ll_send_message"
android:layout_width="match_parent"
android:background="#android:color/white"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_alignParentBottom="true">
<github.ankushsachdeva.emojicon.EmojiconEditText
android:id="#+id/et_message_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:focusable="true"
android:focusableInTouchMode="true"
android:hint="#string/keyMessage"
android:inputType="textMultiLine|textNoSuggestions"
android:background="#android:color/transparent"
android:maxLines="4"
android:paddingBottom="5dp"
android:paddingEnd="0dp"
android:paddingLeft="20dp"
android:paddingRight="0dp"
android:paddingStart="20dp"
android:paddingTop="5dp"
android:textColor="#color/light_black"
android:textColorHint="#color/zipt"
android:textSize="17sp"
emojicon:emojiconSize="18sp" />
<ImageButton />
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
any ideas how i can solve this?

Issue with listview scrollable

i don't know why my list view doesn't scroll completely.
I show you also single list view item.XML about adapter's xml where i put the item for every rows of my listview, so i hope that you can help me!
Thanks everybody!
I show you pic!
https://i.stack.imgur.com/8ub2W.png
this is .xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/a"
android:layout_marginLeft="5dp"
android:background="#color/white"
>
<ListView
android:id="#+id/listview"
android:layout_marginTop="0dp"
android:layout_width="fill_parent"
android:layout_height="match_parent">
</ListView>
</LinearLayout>
single_listview_item.XML
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="8dp"
>
<CheckBox
android:id="#+id/chk_box"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true" />
<ImageView
android:id="#+id/ivImage"
android:layout_width="72dp"
android:layout_height="72dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"/>
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_toRightOf="#id/chk_box"
android:layout_toLeftOf="#id/ivImage"
android:orientation="vertical">
<TextView
android:id="#+id/name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="#id/chk_box"
android:textStyle="bold"
android:textColor="#000000"
android:text="This ia name"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/caratteristica"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/name"
android:layout_toRightOf="#id/chk_box"
android:textStyle="italic"
android:text="This is caratteristica"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/dist"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="12sp"
android:textStyle="italic"
android:text="10"/>
<TextView
android:id="#+id/valuta"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:textSize="12sp"
android:textStyle="italic"
android:text="$"/>
</LinearLayout>
<Spinner
android:id="#+id/simpleSpinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="50dp"
android:entries="#array/country_arrays"
android:visibility="visible"/>
<NumberPicker
android:id="#+id/np"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="visible"/>
</LinearLayout>
</RelativeLayout>
In your adapter's xml , RelativeLayout tag ,write wrap_content replace of match_parent like below;
android:layout_height="wrap_content"
Change your single_listview_item.XML's RelativeLayout from android:layout_height="match_parent" to android:layout_height="wrap_content"
Change your ListView's height to wrap_content too

Issues with matching width and height

I am trying to build this layout
But I am getting this: (The map button in the location would be ideal height and width but the textview doesn't match the height)
My location is a TextView and my destination is a EditText
I want the TextView and EditText to be the same width while the MAP buttons stay "square".
How can I get the textviews height to match and make a square map button?
Here is my layout
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/fragment_details"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.mycompany.controller.DetailsFragment">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#id/viewStatus"
android:layout_marginTop="5dp">
<LinearLayout
android:id="#+id/scrollViewDetails"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<!-- LOCATION -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="LOCATION"
android:textColor="#color/COLOR_BLUE"
android:textSize="24sp"/>
<LinearLayout
android:id="#+id/layoutLocation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="#+id/tvLocation"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:layout_weight=".8"
android:background="#color/COLOR_LIGHT_GREY"
android:text="123 MAIN ST., CHATTANOOGA TN 37404"
android:textSize="24sp"/>
<Button
android:id="#+id/btnMapLocation"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight=".2"
android:background="#color/COLOR_BLUE"
android:text="MAP"
android:textColor="#color/COLOR_WHITE"/>
</LinearLayout>
<!-- DESTINATION -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="DESTINATION"
android:textColor="#color/COLOR_BLUE"
android:textSize="24sp"/>
<LinearLayout
android:id="#+id/layoutDestination"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<EditText
android:id="#+id/editDestination"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight=".8"
android:ems="10"
android:inputType="textMultiLine"
android:text="407 Broad St., Anywhere ST 00000"/>
<Button
android:id="#+id/btnMapDestination"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight=".2"
android:background="#color/COLOR_BLUE"
android:text="MAP"
android:textColor="#color/COLOR_WHITE"/>
</LinearLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>
I did a slight modification in your code check it!
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/fragment_details"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="5dp">
<LinearLayout
android:id="#+id/scrollViewDetails"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<!-- LOCATION -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="LOCATION"
android:textSize="24sp"/>
<LinearLayout
android:id="#+id/layoutLocation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="#+id/searchText"
android:text="Search text here"
android:layout_weight="0.8"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:background="#c8c8c8"
/>
<Button
android:id="#+id/searchButton"
android:text="MAP"
android:layout_weight="0.2"
android:layout_alignParentRight="true"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
/>
/>
</LinearLayout>
<!-- DESTINATION -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="DESTINATION"
android:textSize="24sp"/>
<LinearLayout
android:id="#+id/layoutLocation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<EditText
android:id="#+id/searchText"
android:text="Search text"
android:layout_weight="0.8"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
/>
<Button
android:id="#+id/searchButton"
android:text="MAP"
android:layout_weight="0.2"
android:layout_alignParentRight="true"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
/>
</LinearLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>
Since you are using android:layout_weight, set android:layout_width="0dp"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/fragment_details"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.mycompany.controller.DetailsFragment">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#id/viewStatus"
android:layout_marginTop="5dp">
<LinearLayout
android:id="#+id/scrollViewDetails"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<!-- LOCATION -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="LOCATION"
android:textColor="#color/COLOR_BLUE"
android:textSize="24sp"/>
<LinearLayout
android:id="#+id/layoutLocation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="#+id/tvLocation"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:layout_weight=".8"
android:background="#color/COLOR_LIGHT_GREY"
android:text="123 MAIN ST., CHATTANOOGA TN 37404"
android:textSize="24sp"/>
<Button
android:id="#+id/btnMapLocation"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".2"
android:background="#color/COLOR_BLUE"
android:text="MAP"
android:textColor="#color/COLOR_WHITE"/>
</LinearLayout>
<!-- DESTINATION -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="DESTINATION"
android:textColor="#color/COLOR_BLUE"
android:textSize="24sp"/>
<LinearLayout
android:id="#+id/layoutDestination"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<EditText
android:id="#+id/editDestination"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".8"
android:ems="10"
android:inputType="textMultiLine"
android:text="407 Broad St., Anywhere ST 00000"/>
<Button
android:id="#+id/btnMapDestination"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".2"
android:background="#color/COLOR_BLUE"
android:text="MAP"
android:textColor="#color/COLOR_WHITE"/>
</LinearLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>

Android layout_weight not working as it should be

I'm trying to set my ImageView and LinearLayout to have half of the screen each. This works fine on tablets, but on smaller screens the image takes up the entire screen (thus, not actually working).
The way I see it is, I have set a layout_weight="1" on both the ImageView and LinearLayout and the layout_width="0dp" on both also. This SHOULD work, as I have researched a lot into this.
My Code:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/button_text_white">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:scrollbars="none">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#drawable/image"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:padding="20dp"
android:orientation="vertical"
android:gravity="bottom">
<TextView
android:id="#+id/text_view_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="25dp"
android:gravity="center"
android:textSize="24dp"
android:textColor="#color/button_text_white"
android:visibility="invisible"/>
<TextView
android:id="#+id/text_username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/sign_up_in_username_text"
android:textColor="#color/color"/>
<EditText
android:id="#+id/edit_text_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:inputType="text"
android:textColor="#color/color"
android:hint="#string/sign_up_in_username_hint"/>
<TextView
android:id="#+id/text_email"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/sign_up_in_email_text"
android:textColor="#color/color"/>
<EditText
android:id="#+id/edit_text_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:inputType="textEmailAddress"
android:textColor="#color/color"
android:hint="#string/sign_up_in_email_hint"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/sign_up_in_password_text"
android:textColor="#color/color"/>
<EditText
android:id="#+id/edit_text_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:inputType="textPassword"
android:textColor="#color/color"
android:hint="#string/sign_up_in_password_hint"/>
<TextView
android:id="#+id/text_view_forgotten_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:gravity="right"
android:text="#string/forgotten_password_text"
android:textColor="#color/color"/>
<Button
android:id="#+id/button_sign_up_in"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:textColor="#color/color"/>
</LinearLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>
Thanks, appreciate any help!
I would say your problem is with your LinearLayout's height being set to match_parent inside of a ScrollView.
As you know, a ScrollView expands to fit its contents - now if you tell its contents to expand as big as its parent (match_parent), then you have a paradox.
Try setting the child of your ScrollView's height to wrap_content instead of match_parent.
There is no use for your ScrollView & it's parent RelativeLayout. Cut down your layout as below.
<LinearLayout>
<ImageView w="1"/>
<ScrollView w="1">
<LinearLayout>
....
</LinearLayout>
</ScrollView>
</LinearLayout>
.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#color/button_text_white">
<ImageView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#drawable/image"/>
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:scrollbars="none">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="20dp"
android:orientation="vertical"
android:gravity="bottom">
<TextView
android:id="#+id/text_view_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="25dp"
android:gravity="center"
android:textSize="24dp"
android:textColor="#color/button_text_white"
android:visibility="invisible"/>
<TextView
android:id="#+id/text_username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/sign_up_in_username_text"
android:textColor="#color/color"/>
<EditText
android:id="#+id/edit_text_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:inputType="text"
android:textColor="#color/color"
android:hint="#string/sign_up_in_username_hint"/>
<TextView
android:id="#+id/text_email"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/sign_up_in_email_text"
android:textColor="#color/color"/>
<EditText
android:id="#+id/edit_text_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:inputType="textEmailAddress"
android:textColor="#color/color"
android:hint="#string/sign_up_in_email_hint"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/sign_up_in_password_text"
android:textColor="#color/color"/>
<EditText
android:id="#+id/edit_text_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:inputType="textPassword"
android:textColor="#color/color"
android:hint="#string/sign_up_in_password_hint"/>
<TextView
android:id="#+id/text_view_forgotten_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:gravity="right"
android:text="#string/forgotten_password_text"
android:textColor="#color/color"/>
<Button
android:id="#+id/button_sign_up_in"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:textColor="#color/color"/>
</LinearLayout>
</ScrollView>
</LinearLayout>

Categories