I want my one textbox to only wrap content till the beginning of the next textbox.
Screenshot now:
and how I want it:
I was thinking I could set the width but it wouldn't display correctly on different size screens, I want it to end there so I can have it ellipses if the content goes out of the area.
Please help!
Layout:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.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:id="#+id/cardView_item_assesment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="4dp"
android:clickable="true"
android:focusable="true"
app:cardCornerRadius="4dp"
app:cardElevation="4dp"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/textView_title"
android:layout_width="285dp"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginEnd="5dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginStart="5dp"
android:layout_marginTop="5dp"
android:ellipsize="end"
android:maxLines="1"
android:scrollHorizontally="true"
android:textColor="#color/colorPrimaryDark"
android:textSize="30sp"
tools:text="PlaceHolder" />
<TextView
android:id="#+id/textView_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:textColor="#color/colorPrimaryDark"
android:textSize="15sp"
android:layout_margin="5dp"
tools:text="2018/09/02" />
<TextView
android:id="#+id/textView_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/textView_date"
android:layout_alignParentEnd="true"
android:textColor="#color/colorPrimaryDark"
android:textSize="15sp"
android:layout_margin="5dp"
tools:text="09:00" />
<TextView
android:id="#+id/textView_total"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toEndOf="#id/editText_achieved"
android:layout_below="#+id/textView_title"
android:textColor="#color/colorPrimaryDark"
android:layout_alignBaseline="#id/editText_achieved"
android:textSize="20sp"
android:layout_margin="5dp"
tools:text="Total: 100" />
<android.support.v7.widget.AppCompatEditText
android:id="#+id/editText_achieved"
android:layout_width="130dp"
android:layout_height="wrap_content"
android:layout_below="#+id/textView_title"
android:maxLines="1"
android:textColor="#color/colorPrimaryDark"
android:textSize="20sp"
tools:text="Result: 50" />
<TextView
android:id="#+id/textView_contribution"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/textView_total"
android:textColor="#color/colorPrimaryDark"
android:textSize="20sp"
android:layout_margin="5dp"
tools:text="Weight: 25%"/>
<TextView
android:id="#+id/txtID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="invisible" />
</RelativeLayout>
add:
android:layout_alignParentLeft="true"
android:layout_toLeftOf="#+id/textView_date"
and set width to wrap_content in your first TextView
<TextView
android:id="#+id/textView_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginEnd="5dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginStart="5dp"
android:layout_marginTop="5dp"
android:layout_toLeftOf="#+id/textView_date"
android:layout_alignParentLeft="true"
android:ellipsize="end"
android:maxLines="1"
android:scrollHorizontally="true"
android:textColor="#color/colorPrimaryDark"
android:textSize="30sp"
tools:text="PlaceHolder" />
result
Use LinearLayout for this...
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="1"
android:padding="10dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="text"
android:layout_weight=".4"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="12/12/1212"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="9:00"/>
</LinearLayout>
</LinearLayout>
Result:
Related
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
I've created a preference UI but the thing is I can't let the bottommost child view to be displayed on the device. It keeps discarding the bottommost view. Though this query is similar to one I found in the query list yet the problem I'm facing left me with no debugging ways or I'm missing some serious property.
My code is:
The Bottom TextView which I finally wrapped inside a relativeView is the part which is discarded.
To ,y wonder I changed to LinearLayout from Relative built I guess It might have some issues as well..
But the most important query is that it doesn't scroll till the end of the Activity.
<?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="match_parent"
tools:context=".Preferences">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="60dp"
android:background="#color/colorPrimary"
android:id="#+id/header"
enter code here
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/back_key"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/text_prefer"
android:layout_centerInParent="true"
android:layout_centerVertical="true"
android:text="#string/activity_name"
android:textColor="#color/white"
android:textStyle="bold"
android:textSize="18sp"
/>
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/wrapper_scroll"
android:layout_below="#id/header"
>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/scroll_horizontal"
android:fillViewport="true"
>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginLeft="11dp"
android:layout_marginRight="11dp"
android:id="#+id/rel_scroll"
android:layout_marginBottom="10dp"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="120dp"
android:background="#drawable/rounded_back_for_layout"
android:id="#+id/rel_age_layout"
android:layout_marginBottom="5dp"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="18dp"
android:id="#+id/age_text"
android:text="#string/age"
android:textSize="14sp"
android:textStyle="bold"
android:textColor="#color/magenta_brown"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="18dp"
android:layout_alignParentRight="true"
android:text="18-26"
android:textStyle="bold"
android:textSize="14sp"
android:textColor="#color/black"
/>
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/text_age_pref"
android:layout_below="#id/rel_age_layout"
android:text="#string/age_prefer"
android:textSize="10.5sp"
android:layout_marginLeft="3dp"
android:layout_marginRight="3dp"
/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="45dp"
android:layout_below="#id/rel_age_layout"
android:background="#drawable/rounded_back_for_layout"
android:id="#+id/rel_interest_layout"
android:layout_marginBottom="5dp"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:id="#+id/interested_in_text"
android:text="#string/interested_in"
android:textSize="14sp"
android:textStyle="bold"
android:textColor="#color/magenta_brown"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="18dp"
android:layout_below="#id/interested_in_text"
android:text="#string/men"
android:textSize="14sp"
android:textColor="#color/black"
android:id="#+id/men"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="18dp"
android:layout_below="#id/men"
android:layout_marginTop="10dp"
android:text="#string/women"
android:textSize="14sp"
android:textColor="#color/black"
android:layout_marginBottom="10dp"
/>
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/interested_pref"
android:layout_below="#id/rel_interest_layout"
android:text="#string/interested_prefer"
android:textSize="10.5sp"
android:layout_marginLeft="3dp"
android:layout_marginRight="3dp"
/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="38dp"
android:layout_below="#id/rel_interest_layout"
android:background="#drawable/rounded_back_for_layout"
android:id="#+id/rel_alerts_layout"
android:layout_marginBottom="5dp"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="18dp"
android:id="#+id/alerts_mode"
android:text="#string/alerts"
android:textSize="14sp"
android:textStyle="bold"
android:textColor="#color/magenta_brown"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="18dp"
android:layout_below="#id/alerts_mode"
android:text="#string/sound"
android:textSize="14sp"
android:layout_marginBottom="14dp"
android:textColor="#color/black"
/>
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/sound_prefer"
android:layout_below="#id/rel_alerts_layout"
android:textSize="10.5sp"
android:layout_marginLeft="3dp"
android:layout_marginRight="3dp"
/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="45dp"
android:layout_marginBottom="5dp"
android:layout_below="#id/rel_alerts_layout"
android:background="#drawable/rounded_back_for_layout"
android:id="#+id/rel_matchmaker_layout"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="18dp"
android:id="#+id/matchmaker_text"
android:text="#string/matchmaker"
android:textSize="14sp"
android:textStyle="bold"
android:textColor="#color/magenta_brown"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginLeft="18dp"
android:layout_below="#id/matchmaker_text"
android:text="#string/hide_my_prof"
android:textSize="14sp"
android:textColor="#color/black"
android:layout_marginBottom="10dp"
/>
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/matchmaker_prefer"
android:text="#string/matchmaker_prefer"
android:layout_below="#id/rel_matchmaker_layout"
android:textSize="12sp"
/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="38dp"
android:layout_below="#id/rel_matchmaker_layout"
android:background="#drawable/rounded_back_for_layout"
android:id="#+id/rel_whitelist_layout"
android:layout_marginBottom="10dp"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="18dp"
android:id="#+id/whitelist_text"
android:text="#string/whitelist"
android:textSize="14sp"
android:textStyle="bold"
android:textColor="#color/magenta_brown"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="18dp"
android:layout_alignParentRight="true"
android:text="#string/go"
android:padding="10dp"
android:background="#drawable/edittext_rectangle_border"
android:textStyle="bold"
android:textSize="14sp"
android:textColor="#color/black"
/>
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/rel_whitelist_layout"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10.5sp"
android:layout_marginLeft="3dp"
android:layout_marginRight="3dp"
android:text="#string/whitelist_prefer"
/>
</RelativeLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>
</RelativeLayout>
Here's the screenshot:
Try changing the height of the ScrollView from match_parent to wrap_content:
<ScrollView
...
android:layout_height="wrap_content"
... >
I tried your xml and this worked.
Add this to your last TextView
android:layout_margin="18dp"
Your last element will be:
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/rel_whitelist_layout">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10.5sp"
android:layout_marginLeft="3dp"
android:layout_marginRight="3dp"
android:layout_margin="18dp"
android:text="#string/whitelist_prefer"/>
</RelativeLayout>
I saw so many people ask the same question in here, but I still cannot find the reason why my scrollview doesn't work.
Here is my 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:id="#+id/activity_upload"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="5dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="5dp"
android:fillViewport="true"
tools:context="com.example.daniw.traekle.upload">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:id="#+id/tv_itemName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Item Name"
android:textColor="#000000"
android:textStyle="bold"
android:textSize="20sp"
android:layout_marginBottom="5dp"/>
<EditText
android:id="#+id/et_itemTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Title"
android:layout_marginBottom="5dp"
android:textColor="#000000"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:text="Book ISBN(option)"
android:id="#+id/tv_bISBN"
android:textSize="20sp"
android:textStyle="bold"
android:textColor="#000000" />
<EditText
android:id="#+id/et_ISBN"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:textColor="#000000"
android:text="test"/>
<TextView
android:id="#+id/tv_itemPrice"
android:text="Price"
android:textStyle="bold"
android:textSize="20sp"
android:textColor="#000000"
android:layout_marginBottom="5dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<EditText
android:id="#+id/et_itemPrice"
android:text="Test"
android:textColor="#000000"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"/>
<TextView
android:id="#+id/tv_itemDescription"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Item Description"
android:textSize="20sp"
android:textColor="#000000"
android:textStyle="bold"
android:layout_marginBottom="5dp"/>
<android.support.design.widget.TextInputLayout
android:id="#+id/inputLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:counterEnabled="true"
app:counterMaxLength="600"
app:counterOverflowTextAppearance="#style/MyOverflowText">
<EditText
android:id="#+id/et_itemDescription"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:text="Test"
android:maxLength="600"
android:textColor="#000000"/>
</android.support.design.widget.TextInputLayout>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:text="Choose Image"
android:id="#+id/b_chooseImage"/>
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:id="#+id/itemImage"/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Post Item"
android:id="#+id/bPost"/>
</LinearLayout>
</ScrollView>
That is so weird, because I finished other layout use the scrollview it's work fine, but in this activity the scrollview doesn't even show in preview.
There no scroll
You have your LinearLayout height set to fill_parent which is deprecated but is the same thing is match_parent instead your LinearLayout height should be set to wrap_content.
The reason is that your LinearLayout has the same exact height as the ScrollView so there is no need to scroll. If you set it to wrap_content the LinearLayout can have a height larger then the ScrollView which will scroll to show what is outside of ScrollViews bounds
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/activity_upload"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="5dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="5dp"
android:fillViewport="true"
tools:context="com.example.daniw.traekle.upload">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/tv_itemName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Item Name"
android:textColor="#000000"
android:textStyle="bold"
android:textSize="20sp"
android:layout_marginBottom="5dp"/>
<EditText
android:id="#+id/et_itemTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Title"
android:layout_marginBottom="5dp"
android:textColor="#000000"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:text="Book ISBN(option)"
android:id="#+id/tv_bISBN"
android:textSize="20sp"
android:textStyle="bold"
android:textColor="#000000" />
<EditText
android:id="#+id/et_ISBN"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:textColor="#000000"
android:text="test"/>
<TextView
android:id="#+id/tv_itemPrice"
android:text="Price"
android:textStyle="bold"
android:textSize="20sp"
android:textColor="#000000"
android:layout_marginBottom="5dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<EditText
android:id="#+id/et_itemPrice"
android:text="Test"
android:textColor="#000000"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"/>
<TextView
android:id="#+id/tv_itemDescription"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Item Description"
android:textSize="20sp"
android:textColor="#000000"
android:textStyle="bold"
android:layout_marginBottom="5dp"/>
<android.support.design.widget.TextInputLayout
android:id="#+id/inputLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:counterEnabled="true"
app:counterMaxLength="600"
app:counterOverflowTextAppearance="#style/MyOverflowText">
<EditText
android:id="#+id/et_itemDescription"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:text="Test"
android:maxLength="600"
android:textColor="#000000"/>
</android.support.design.widget.TextInputLayout>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:text="Choose Image"
android:id="#+id/b_chooseImage"/>
<ImageView
android:layout_width="match_parent"
android:layout_height="150dp"
android:layout_margin="5dp"
android:paddingBottom="16dp"
android:scaleType="fitXY"
android:id="#+id/itemImage"/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Post Item"
android:id="#+id/bPost"/>
</LinearLayout>
</ScrollView>
Just realize how stupid am I , i finish fixed this problem.
<?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/activity_upload"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="5dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="5dp"
android:fillViewport="true"
tools:context="com.example.daniw.traekle.upload">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:text="Choose Image"
android:id="#+id/b_chooseImage"/>
<ImageView
android:layout_width="fill_parent"
android:layout_height="200dp"
android:layout_margin="5dp"
android:layout_marginBottom="5dp"
android:paddingBottom="50dp"
android:paddingLeft="3dp"
android:paddingRight="3dp"
android:paddingTop="3dp"
android:scaleType="fitXY"
android:id="#+id/itemImage"/>
<TextView
android:id="#+id/tv_itemName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Item Name"
android:textColor="#000000"
android:textStyle="bold"
android:textSize="20sp"
android:layout_marginBottom="5dp"/>
<EditText
android:id="#+id/et_itemTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Title"
android:layout_marginBottom="5dp"
android:textColor="#000000"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:text="Book ISBN(option)"
android:id="#+id/tv_bISBN"
android:textSize="20sp"
android:textStyle="bold"
android:textColor="#000000" />
<EditText
android:id="#+id/et_ISBN"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:textColor="#000000"
android:text="test"/>
<TextView
android:id="#+id/tv_itemPrice"
android:text="Price"
android:textStyle="bold"
android:textSize="20sp"
android:textColor="#000000"
android:layout_marginBottom="5dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<EditText
android:id="#+id/et_itemPrice"
android:text="Test"
android:textColor="#000000"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"/>
<TextView
android:id="#+id/tv_itemDescription"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Item Description"
android:textSize="20sp"
android:textColor="#000000"
android:textStyle="bold"
android:layout_marginBottom="5dp"/>
<android.support.design.widget.TextInputLayout
android:id="#+id/inputLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:counterEnabled="true"
app:counterMaxLength="600"
app:counterOverflowTextAppearance="#style/MyOverflowText">
<EditText
android:id="#+id/et_itemDescription"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:text="Test"
android:maxLength="600"
android:textColor="#000000"/>
</android.support.design.widget.TextInputLayout>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Post Item"
android:id="#+id/bPost"/>
</LinearLayout>
</ScrollView>
Now this layout working fine
I have an issue trying align textView to the center of layout: when I try to do this - it has a conflict with a button on the left - if text is too long - it become hidden under the button. Text length can be very different and I need it in the center of layout but not under/on the button.
Here is the xml file of activity layout:
<?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">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/item_content_action_bar_layout"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:background="#color/colorBlue"
android:padding="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/item_content_title"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Title"
android:textColor="#color/colorWhite"
android:textAlignment="center"
android:singleLine="true"
android:layout_gravity="center_vertical"
android:textStyle="bold"
android:autoText="false"
android:layout_centerInParent="true"
android:layout_alignWithParentIfMissing="false"
android:layout_alignParentRight="false" />
<ImageButton
android:layout_width="120dp"
android:layout_height="45dp"
android:id="#+id/item_content_back_button"
android:background="#drawable/back_button_selector"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginRight="5dp" />
</RelativeLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/item_content_scroll_view"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:fillViewport="true">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<ImageView
android:layout_width="125dp"
android:layout_height="125dp"
android:id="#+id/item_content_image"
android:src="#drawable/ic_no_thumbnail"
android:maxHeight="125dp"
android:maxWidth="125dp"
android:layout_alignParentLeft="false"
android:layout_alignParentStart="true"
android:layout_margin="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/item_content_subtitle"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Subtitle"
android:layout_alignTop="#+id/item_content_image"
android:layout_toRightOf="#+id/item_content_image"
android:layout_toEndOf="#+id/item_content_image"
android:textSize="20dp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/item_content_pubdate"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Date"
android:layout_below="#+id/item_content_subtitle"
android:layout_alignLeft="#+id/item_content_subtitle"
android:layout_alignStart="#+id/item_content_subtitle"
android:textSize="10dp"
android:layout_marginTop="10dp" />
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/item_content_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="blabla"
android:layout_below="#+id/item_content_pubdate"
android:layout_alignStart="#+id/item_content_pubdate"
android:layout_alignParentStart="true"
android:layout_margin="10dp" />
</LinearLayout>
</ScrollView>
</LinearLayout>
Try using LinearLayout with layout-weight for this to avoid conflict. Change your first relativelayout to below one
<LinearLayout
android:id="#+id/item_content_action_bar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/_white"
android:orientation="horizontal"
android:padding="10dp"
android:weightSum="7">
<ImageButton
android:id="#+id/item_content_back_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:layout_weight="2"
android:background="#drawable/chemist" />
<TextView
android:id="#+id/item_content_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="5"
android:autoText="false"
android:gravity="center"
android:maxLines="2"
android:singleLine="true"
android:text="Title"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/Black"
android:textStyle="bold" />
</LinearLayout>
Change Your RelativeLayout to LinearLayout and use android:layout_weight attribute of layout to do this.
<LinearLayout
android:id="#+id/item_content_action_bar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/_white"
android:orientation="horizontal"
android:padding="10dp"
android:weightSum="1"
>
<ImageButton
android:id="#+id/item_content_back_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:background="#drawable/chemist" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/item_content_title"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Title"
android:textColor="#color/colorWhite"
android:textAlignment="center"
android:singleLine="true"
android:layout_gravity="center_vertical"
android:textStyle="bold"
android:gravity="center"
android:layout_weight="1"
android:autoText="false"/>
</LinearLayout>
Make the layout_gravity of the textview item_content_title as "center_horizontal".
And add android:layout_toLeftOf="#+id/item_content_title" under the ImageButton item_content_back_button.
Hope it was what you wanted.
Your Action bar layout has to be like this-
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/item_content_action_bar_layout"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:background="#color/colorBlue"
android:padding="10dp">
<ImageButton
android:layout_width="120dp"
android:layout_height="45dp"
android:id="#+id/item_content_back_button"
android:background="#drawable/back_button_selector"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:layout_marginRight="5dp" />
<TextView
android:toRightOf="#id/item_content_back_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/item_content_title"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Title"
android:textColor="#color/colorWhite"
android:textAlignment="center"
android:singleLine="true"
android:layout_gravity="center_vertical"
android:textStyle="bold"
android:autoText="false"
android:layout_centerInParent="true" />
</RelativeLayout>
I am using a RecyclerView with CardViews inside and I want to remove the Margins/Padding/Spacing left in between the children cards inside the RecyclerView. How can I do that?
Here is my CardView:
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="#+id/card_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
card_view:cardUseCompatPadding="false">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="horizontal">
<!--status lock-->
<ImageView
android:id="#+id/imageField"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_margin="20dp" />
<!--text info section-->
<LinearLayout
android:id="#+id/textInfo"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<!--NAME-->
<TextView
android:id="#+id/nameField"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="item name"
android:gravity="center_vertical"
android:textSize="#dimen/abc_text_size_large_material" />
<!--category-->
<TextView
android:id="#+id/categoryField"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:lines="1"
android:maxLines="1"
android:text="category"
android:textSize="#dimen/abc_text_size_small_material" />
<!--working hours-->
<LinearLayout
android:id="#+id/workingHours"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:lines="1"
android:maxLines="1"
android:orientation="horizontal">
<ImageView
android:id="#+id/workingHoursIcon"
android:layout_width="15dp"
android:layout_height="15dp"
android:layout_gravity="center_vertical"
android:background="#drawable/ic_clock"
android:padding="50dp"></ImageView>
<TextView
android:id="#+id/WHStart"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp" />
<TextView
android:id="#+id/dash"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:text=" - " />
<TextView
android:id="#+id/WHEnd"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:lines="1"
android:maxLines="1"
android:paddingLeft="5dp" />
</LinearLayout>
<!--message-->
<LinearLayout
android:id="#+id/messageSection"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/messageIcon"
android:layout_width="15dp"
android:layout_height="15dp"
android:layout_gravity="center_vertical"
android:background="#drawable/ic_message"
android:padding="50dp" />
<TextView
android:id="#+id/message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:lines="1"
android:maxLines="1"
android:paddingLeft="5dp"
android:text="No Message" />
</LinearLayout>
</LinearLayout>
<!--add to favorite button-->
<ImageButton
android:id="#+id/btn_add_to_favorite_list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="20dp"
android:layout_marginLeft="48dp"
android:layout_marginRight="20dp"
android:layout_marginStart="48dp"
android:background="#drawable/ic_star_gray" />
</LinearLayout>
</android.support.v7.widget.CardView>
And my RecyclerView:
<android.support.v7.widget.RecyclerView
android:id="#+id/my_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/my_store"
android:scrollbars="vertical" />
Here is a screenshot:
This might be what you were looking for CardView inside RecyclerView has extra margins
Plus if you are not looking to keep spaces you should simply use a LinearLayout for your adapter layout removing the CardView altogether, that should do it.
Hope that helps.
Check if it is margin or padding (Dev Options / show layout bounds)
CardView adds padding in pre-L API levels to show shadows. In L, unless you set useCompatPadding=true, there should not be any gap.
Adding negative margins (although it is ugly) should work.
This might work
card_view:contentPaddingLeft="-3dp"
card_view:contentPaddingRight="-3dp"
card_view:contentPaddingTop="-3dp"
card_view:contentPaddingBottom="-3dp"
Try this:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.CardView
android:id="#+id/card_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardUseCompatPadding="false">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="horizontal">
<!--status lock-->
<ImageView
android:id="#+id/imageField"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_margin="20dp" />
<!--text info section-->
<LinearLayout
android:id="#+id/textInfo"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<!--NAME-->
<TextView
android:id="#+id/nameField"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="item name"
android:gravity="center_vertical"
android:textSize="#dimen/abc_text_size_large_material" />
<!--category-->
<TextView
android:id="#+id/categoryField"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:lines="1"
android:maxLines="1"
android:text="category"
android:textSize="#dimen/abc_text_size_small_material" />
<!--working hours-->
<LinearLayout
android:id="#+id/workingHours"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:lines="1"
android:maxLines="1"
android:orientation="horizontal">
<ImageView
android:id="#+id/workingHoursIcon"
android:layout_width="15dp"
android:layout_height="15dp"
android:layout_gravity="center_vertical"
android:background="#drawable/ic_clock"
android:padding="50dp"></ImageView>
<TextView
android:id="#+id/WHStart"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp" />
<TextView
android:id="#+id/dash"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:text=" - " />
<TextView
android:id="#+id/WHEnd"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:lines="1"
android:maxLines="1"
android:paddingLeft="5dp" />
</LinearLayout>
<!--message-->
<LinearLayout
android:id="#+id/messageSection"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/messageIcon"
android:layout_width="15dp"
android:layout_height="15dp"
android:layout_gravity="center_vertical"
android:background="#drawable/ic_message"
android:padding="50dp" />
<TextView
android:id="#+id/message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:lines="1"
android:maxLines="1"
android:paddingLeft="5dp"
android:text="No Message" />
</LinearLayout>
</LinearLayout>
<!--add to favorite button-->
<ImageButton
android:id="#+id/btn_add_to_favorite_list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="20dp"
android:layout_marginLeft="48dp"
android:layout_marginRight="20dp"
android:layout_marginStart="48dp"
android:background="#drawable/ic_star_gray" />
</LinearLayout>