I'm making an app where I have a cardview and inside that card view I have an imageview on that image view I'm positioning my other components.
Now my problem is as soon as I start using a layout inside image view my design editor goes blank and when removing the layout from image view the image shows again
I tried searching but I didn't get anything related to this specific problem please correct me if I'm going wrong
below is my XML
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
app:cardCornerRadius="8dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="#+id/feed_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="#drawable/club1"
android:scaleType="fitCenter">
<RelativeLayout>
<de.hdodenhof.circleimageview.CircleImageView
android:id="#+id/profile_image"
android:layout_width="96dp"
android:layout_height="96dp"
android:src="#drawable/ellipse"
android:layout_gravity="top|left"/>
<TextView
android:id="#+id/first_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="John Doe"
android:textSize="15sp"
android:textColor="#color/White"
android:layout_toRightOf="#+id/profile_image"/>
<TextView
android:id="#+id/second_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="checked in to"
android:textSize="9sp"
android:layout_toRightOf="#+id/first_text"
android:textColor="#color/White"/>
<TextView
android:id="#+id/third_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="W south"
android:textSize="15sp"
android:layout_toRightOf="#+id/second_text"
android:textColor="#color/White"/>
<TextView
android:id="#+id/fourth_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/first_text"
android:text="beach mumbai"
android:textSize="15sp"
android:textColor="#color/White"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="30 mins ago."
android:textColor="#color/White"
android:textSize="9sp"
android:layout_toRightOf="#+id/fourth_text"
android:layout_below="#+id/second_text"/>
</RelativeLayout>
</ImageView>
</RelativeLayout>
</android.support.v7.widget.CardView>
You just forgot to give hight width to you RelativeLayout check it
You are adding view inside ImageView
FYI
an
ImageView is not a ViewGroup you can not add view inside it
Change your layout like this
Try this
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
app:cardCornerRadius="8dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/colorAccent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<de.hdodenhof.circleimageview.CircleImageView
android:layout_width="96dp"
android:layout_height="96dp"
android:src="#drawable/abc" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="5dp">
<TextView
android:id="#+id/first_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="John Doe"
android:textColor="#color/colorPrimary"
android:textSize="15sp" />
<TextView
android:id="#+id/second_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="checked in to"
android:textColor="#color/colorPrimary"
android:textSize="9sp" />
<TextView
android:id="#+id/third_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="W south"
android:textColor="#color/colorPrimary"
android:textSize="15sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:orientation="horizontal">
<TextView
android:id="#+id/fourth_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="beach mumbai"
android:textColor="#color/colorPrimary"
android:textSize="15sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/second_text"
android:layout_toRightOf="#+id/fourth_text"
android:text="30 mins ago."
android:textColor="#color/colorPrimary"
android:textSize="9sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="50dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerInParent="true"
android:padding="10dp"
android:text="reply to abc............" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerInParent="true">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/ic_message" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="40 likes" />
</LinearLayout>
</RelativeLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
Wrong ImageView close tag as well RelativeLayout height & width are missing. Please check code.
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
app:cardCornerRadius="8dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="#+id/feed_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="#drawable/club1"
android:scaleType="fitCenter"></ImageView>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<de.hdodenhof.circleimageview.CircleImageView
android:id="#+id/profile_image"
android:layout_width="96dp"
android:layout_height="96dp"
android:src="#drawable/ellipse"
android:layout_gravity="top|left" />
<TextView
android:id="#+id/first_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="John Doe"
android:textSize="15sp"
android:textColor="#color/White"
android:layout_toRightOf="#+id/profile_image" />
<TextView
android:id="#+id/second_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="checked in to"
android:textSize="9sp"
android:layout_toRightOf="#+id/first_text"
android:textColor="#color/White" />
<TextView
android:id="#+id/third_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="W south"
android:textSize="15sp"
android:layout_toRightOf="#+id/second_text"
android:textColor="#color/White" />
<TextView
android:id="#+id/fourth_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/first_text"
android:text="beach mumbai"
android:textSize="15sp"
android:textColor="#color/White" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="30 mins ago."
android:textColor="#color/White"
android:textSize="9sp"
android:layout_toRightOf="#+id/fourth_text"
android:layout_below="#+id/second_text" />
</RelativeLayout>
</RelativeLayout>
</android.support.v7.widget.CardView
The problem is that you're treating ImageView like it was a ViewGroup, which it isn't. You can only nest views inside a ViewGroup. The simplest solution to your question would be to take everything you've put inside ImageView and put it inside your parent RelativeLayout like this:
<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
app:cardCornerRadius="8dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="#+id/feed_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="#drawable/club1"
android:scaleType="fitCenter"/>
<de.hdodenhof.circleimageview.CircleImageView
android:id="#+id/profile_image"
android:layout_width="96dp"
android:layout_height="96dp"
android:src="#drawable/ellipse"
android:layout_gravity="top|left"/>
<TextView
android:id="#+id/first_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="John Doe"
android:textSize="15sp"
android:textColor="#color/White"
android:layout_toRightOf="#+id/profile_image"/>
<TextView
android:id="#+id/second_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="checked in to"
android:textSize="9sp"
android:layout_toRightOf="#+id/first_text"
android:textColor="#color/White"/>
<TextView
android:id="#+id/third_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="W south"
android:textSize="15sp"
android:layout_toRightOf="#+id/second_text"
android:textColor="#color/White"/>
<TextView
android:id="#+id/fourth_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/first_text"
android:text="beach mumbai"
android:textSize="15sp"
android:textColor="#color/White"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="30 mins ago."
android:textColor="#color/White"
android:textSize="9sp"
android:layout_toRightOf="#+id/fourth_text"
android:layout_below="#+id/second_text"/>
</RelativeLayout>
</android.support.v7.widget.CardView>
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
Im trying to make an app in android studio. I have a textview with a circular background. The thing is that when i install it on ta physical device the Text view goes of the screen.
Hers the preview in android studio:
The Xml code:
<?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"
android:background="#000000"
>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="55dp"
android:orientation="horizontal"
android:background="#drawable/top_bar">
<TextView
android:id="#+id/textView3"
android:layout_width="40dp"
android:layout_height="match_parent"
android:layout_weight="0"
android:drawableLeft="#drawable/ic_keyboard_arrow_left_black_24dp"
/>
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:fontFamily="#font/segoeui"
android:gravity="center_vertical|start"
android:text="App name and image"
android:textColor="#FFFFFF"
android:textSize="30dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="45dp"
android:orientation="vertical">
<TextView
android:id="#+id/textView6"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fontFamily="#font/segoeui"
android:gravity="center"
android:text="Pakistan vs Australia T20"
android:textColor="#ffff"
android:textSize="24dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1.5dp"
android:background="#ffff"
android:orientation="vertical"
android:layout_marginLeft="47dp"
android:layout_marginRight="47dp"></LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="300dp"
android:orientation="horizontal">
<LinearLayout
android:layout_width="247dp"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:fontFamily="#font/segoeui"
android:gravity="center"
android:text="Match Odds"
android:textColor="#ffff"
android:textSize="17dp" />
<TextView
android:id="#+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:fontFamily="#font/segoeui"
android:paddingLeft="10dp"
android:text="Favourite"
android:textColor="#ffff"
android:textSize="17dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="30dp"
android:orientation="horizontal">
<TextView
android:id="#+id/textView12"
android:layout_width="40dp"
android:layout_height="wrap_content"
android:gravity="center"
android:text="0"
android:textColor="#ffff"
android:textSize="20dp"
android:textStyle="bold" />
<TextView
android:id="#+id/textView11"
android:layout_width="20dp"
android:layout_height="wrap_content"
android:gravity="center"
android:text="-"
android:textColor="#ffff"
android:textSize="20dp"
android:textStyle="bold" />
<TextView
android:id="#+id/textView10"
android:layout_width="40dp"
android:layout_height="wrap_content"
android:gravity="center"
android:text="0"
android:textColor="#ffff"
android:textSize="20dp"
android:textStyle="bold" />
</LinearLayout>
<TextView
android:id="#+id/textView13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="40dp"
android:layout_marginTop="30dp"
android:fontFamily="#font/segoeui"
android:gravity="center"
android:text="WestIndies"
android:textColor="#ffff"
android:textSize="16dp"
android:visibility="visible" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="horizontal">
<TextView
android:id="#+id/textView4"
android:layout_width="100dp"
android:layout_height="1dp"
android:layout_marginLeft="6dp"
android:background="#color/margins"
android:text="TextView" />
<TextView
android:id="#+id/textView7"
android:layout_width="100dp"
android:layout_height="1dp"
android:layout_marginLeft="30dp"
android:background="#color/margins"
android:text="TextView" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="horizontal">
<TextView
android:id="#+id/textView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:fontFamily="#font/segoeui"
android:gravity="center"
android:text="Session"
android:textColor="#ffff"
android:textSize="17dp" />
<TextView
android:id="#+id/textView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:fontFamily="#font/segoeui"
android:gravity="center"
android:text="Runs/Balls"
android:textColor="#ffff"
android:textSize="17dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:orientation="horizontal">
<TextView
android:id="#+id/textView17"
android:layout_width="40dp"
android:layout_height="wrap_content"
android:gravity="center"
android:text="0"
android:textColor="#FF0000"
android:textSize="20dp"
android:textStyle="bold" />
<TextView
android:id="#+id/textView18"
android:layout_width="20dp"
android:layout_height="wrap_content"
android:gravity="center"
android:text="-"
android:textColor="#ffff"
android:textSize="20dp"
android:textStyle="bold" />
<TextView
android:id="#+id/textView19"
android:layout_width="40dp"
android:layout_height="wrap_content"
android:gravity="center"
android:text="0"
android:textColor="#ffff"
android:textSize="20dp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal">
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="0dp"
android:orientation="vertical"
>
<TextView
android:id="#+id/TextViewID"
android:layout_width="110dp"
android:layout_height="110dp"
android:layout_marginTop="80dp"
android:layout_marginLeft="35dp"
android:background="#drawable/green_circle"
android:gravity="center"
android:text="2"
android:textColor="#ff2800"
android:textSize="13sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>
What im getting on the screen:
ive tried using different devices with different screen sizes but all give the same result. How can i solve this.
TIA..!!!
I think it's because the LinearLayout where that round TextView is, is actually a child of another LinearLayout with horizontal orientation, and you have another empty LinearLayout of width 250dp right before it, which pushes the relevant layout out of screen. Can you try removing the empty LinearLayout and see if it helps?
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 am not able to find out the exact issue that why the image(background) is not visible in API level 16 but it is showing good in API level 19. I have worked simply as i have done previously but , this time the background is not shown(of WaterMark in ImageView).
I am not able to find out what is exact issue . So i need help.I have done every thing as suggested in the stack Android device is not showing the background image but it is not going good in my case.
xml
<?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"
android:orientation="vertical">
<ScrollView
android:id="#+id/scrollLogin"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/rlGetInTouch"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#android:color/transparent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#304EA2">
<RelativeLayout
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/header_bg2">
<ImageView
android:id="#+id/brand"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="#drawable/nbl_logo4" />
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#304EA2">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:layout_marginBottom="35dp"
android:layout_marginTop="-60dp"
android:color="#android:color/transparent"
android:src="#drawable/logowatermark" />
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/edit_text_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="10dp"
android:paddingLeft="35dp"
android:paddingRight="35dp">
<******.CustomFontLoginTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="20dp"
android:text=" Please login to proceed"
android:textColor="#color/white"
android:textSize="12sp"
android:textStyle="normal" />
<******.CustomFontEditText
android:id="#+id/etUsername"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:background="#drawable/edit_text_border"
android:drawablePadding="8dp"
android:gravity="center"
android:hint="Mobile Number"
android:inputType="number"
android:maxLength="#integer/mobile_length"
android:padding="13dp"
android:textCursorDrawable="#drawable/color_cursor"
android:textSize="12dp"
android:textStyle="bold" />
<******.CustomFontEditText
android:id="#+id/etPassword"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="12dp"
android:layout_toLeftOf="#+id/passwordVisibilityBtn"
android:background="#drawable/edit_text_border"
android:drawablePadding="8dp"
android:gravity="center"
android:hint="Password"
android:inputType="textPassword"
android:maxLength="#integer/password_length"
android:padding="13dp"
android:textCursorDrawable="#drawable/color_cursor"
android:textSize="12dp"
android:textStyle="bold" />
<******.CustomFontCheckBox
android:id="#+id/chkSaveUsername"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:button="#drawable/custom_checkbox"
android:drawablePadding="5dp"
android:gravity="center"
android:text=" Remember Mobile No."
android:textColor="#color/white"
android:textSize="12sp"
android:textStyle="normal" />
<LinearLayout
android:id="#+id/loginLl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="#drawable/login_button_shadow"
android:orientation="vertical">
<******.CustomFontLoginTextView
android:id="#+id/btnLogin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="#drawable/login_button_new1"
android:clickable="true"
android:gravity="center"
android:padding="13dp"
android:text="Login"
android:textAllCaps="true"
android:textColor="#color/white"
android:textSize="14sp" />
<******.CustomFontLoginTextView
android:id="#+id/action_sms"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="10dp"
android:background="#drawable/login_button_new1"
android:clickable="true"
android:gravity="center"
android:paddingBottom="10dp"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:paddingTop="10dp"
android:text="Switch To SMS"
android:textColor="#color/white"
android:textSize="12sp" />
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp">
<******.CustomFontLoginTextView
android:id="#+id/resetDeviceId"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:alpha="0.7"
android:drawableLeft="#drawable/icon_reset_20"
android:drawablePadding="3dp"
android:gravity="center"
android:text="#string/reset_device_id_text"
android:textColor="#color/white"
android:textSize="12sp" />
<******.CustomFontLoginTextView
android:id="#+id/action_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:alpha="0.7"
android:drawableLeft="#drawable/icon_info_20"
android:drawablePadding="3dp"
android:gravity="center"
android:text="#string/info"
android:textColor="#color/white"
android:textSize="12sp" />
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
<!-- Promo -->
<LinearLayout
android:id="#+id/llPromotions"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="#+id/promo_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/llBranches"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/rlLogin"
android:layout_gravity="center"
android:background="#304EA2"
android:gravity="center"
android:orientation="horizontal"
android:padding="15dp">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:clickable="true"
android:onClick="showATMs"
android:orientation="vertical">
<de.hdodenhof.circleimageview.CircleImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|center_vertical"
android:padding="2dp"
android:src="#drawable/icon_atm_50_6" />
<******.CustomFontLoginTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="8dp"
android:text="ATM"
android:textColor="#FFFFFF"
android:textSize="12sp" />
<******.CustomFontLoginTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="3dp"
android:text="Locate nearest Atm Machines"
android:textColor="#FFFFFF"
android:textSize="8sp" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:clickable="true"
android:onClick="showBranches"
android:orientation="vertical">
<de.hdodenhof.circleimageview.CircleImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:padding="2dp"
android:src="#drawable/ic_branches_50_6" />
<******.CustomFontLoginTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:paddingTop="8dp"
android:text="BRANCHES"
android:textColor="#FFFFFF"
android:textSize="12sp" />
<******.CustomFontLoginTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="3dp"
android:text="Locate nearest bank branches"
android:textColor="#FFFFFF"
android:textSize="8sp" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:clickable="true"
android:onClick="showRates"
android:orientation="vertical">
<de.hdodenhof.circleimageview.CircleImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:padding="2dp"
android:src="#drawable/ic_rates_50_6" />
<******.CustomFontLoginTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="8dp"
android:text="RATES"
android:textColor="#FFFFFF"
android:textSize="12sp" />
<******.CustomFontLoginTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="3dp"
android:text="Foreign exchange and stock rates"
android:textColor="#FFFFFF"
android:textSize="8sp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/rlProducts"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:orientation="vertical">
<******.CustomFontLoginTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="10dp"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:text="Products"
android:textAllCaps="true"
android:textColor="#color/gray"
android:textSize="14sp" />
<!--Product Container-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<!--Product 1-->
<LinearLayout
android:id="#+id/product_content1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginRight="7.5dp"
android:layout_weight="1"
android:orientation="vertical" />
<!--Product 2-->
<LinearLayout
android:id="#+id/product_content2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="7.5dp"
android:layout_marginRight="15dp"
android:layout_weight="1"
android:gravity="end"
android:orientation="vertical" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>
<RelativeLayout
android:id="#+id/rlGetInTouch"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#304EA2"
android:orientation="horizontal">
<CustomFontLoginTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toLeftOf="#+id/btnCall"
android:paddingLeft="15dp"
android:singleLine="true"
android:text="Get in touch with us"
android:textColor="#color/white"
android:textSize="16sp"
android:textStyle="normal" />
<!--app:maxTextSize="14sp"
app:minTextSize="#dimen/minFontSize"-->
<de.hdodenhof.circleimageview.CircleImageView
android:id="#+id/btnMap"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginRight="10dp"
android:onClick="showLocation"
android:src="#drawable/ic_action_location_24_4" />
<de.hdodenhof.circleimageview.CircleImageView
android:id="#+id/btnEmail"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_alignParentTop="true"
android:layout_toLeftOf="#+id/btnMap"
android:layout_toStartOf="#+id/btnMap"
android:onClick="openEmail"
android:src="#drawable/ic_action_mail_24_4" />
<de.hdodenhof.circleimageview.CircleImageView
android:id="#+id/btnCall"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_alignParentTop="true"
android:layout_toLeftOf="#+id/btnEmail"
android:layout_toStartOf="#+id/btnEmail"
android:onClick="openCall"
android:src="#drawable/ic_action_call_24_4" />
</RelativeLayout>
</RelativeLayout>
The Image background of watermark is not shown. I have done nothing
new ,same as previous but dont' know that is the exact issue.
Please reduce image size to visible in the lower level device.
I Just Removed marginTop and it worked fine in API level 16
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:layout_marginBottom="35dp"
android:src="#drawable/logowatermark" />
I don't understand that why it worked when i remove the -ve marginTop
in above? .I got solution but don't understand what exactly happened
in adding -ve marginTop and with removing -ve marginTop.
My layout.xml code:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:tag="cards main container">
<android.support.v7.widget.CardView
android:id="#+id/card_view"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="210dp"
card_view:cardBackgroundColor="#color/color_white"
card_view:cardCornerRadius="10dp"
card_view:cardElevation="5dp"
card_view:cardUseCompatPadding="true">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal">
<TextView
android:id="#+id/match_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15sp"
android:paddingStart="30dp"
android:paddingTop="10dp"
tools:text="2nd ODI"/>
<TextView
android:id="#+id/match_series_separator"
android:layout_toRightOf="#+id/match_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15sp"
android:paddingTop="10dp"
android:paddingStart="5dp"
android:text="-"
/>
<TextView
android:id="#+id/series_name"
android:layout_toRightOf="#+id/match_series_separator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15sp"
android:paddingStart="5dp"
android:paddingTop="10dp"
tools:text="India Tour of SriLanka,5 ODIs,2010"
/>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp">
<ImageView
android:id="#+id/team_logo_1"
android:tag="image_tag"
android:layout_alignParentStart="true"
android:layout_width="65dp"
android:layout_height="100dp"
android:layout_margin="5dp"
android:src="#drawable/matches"/>
<TextView
android:id="#+id/score_team_1"
android:layout_centerVertical="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20sp"
tools:text="100/3"
android:layout_toEndOf="#+id/team_logo_1"/>
<TextView
android:id="#+id/overs_team_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20sp"
android:paddingTop="50dp"
android:paddingStart="15dp"
tools:text="20"
android:layout_centerVertical="true"
android:layout_toEndOf="#+id/team_logo_1" />
<ImageView
android:id="#+id/team_logo_2"
android:layout_alignParentEnd="true"
android:tag="image_tag"
android:layout_width="65dp"
android:layout_height="100dp"
android:layout_margin="5dp"
android:src="#drawable/matches"/>
<TextView
android:id="#+id/score_team_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:textSize="20sp"
tools:text="100/3"
android:layout_toStartOf="#+id/team_logo_2"/>
<TextView
android:id="#+id/overs_team_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/score_team_2"
android:layout_centerVertical="true"
android:textSize="20sp"
android:paddingTop="50dp"
android:paddingEnd="15dp"
android:layout_toStartOf="#+id/team_logo_2"
tools:text="20"/>
</RelativeLayout>
<TextView
android:id="#+id/match_status_result"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
tools:text="Match in progress/ India won by 3 wickets"/>
<TextView
android:id="#+id/target_leadby"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="10dp"
android:layout_gravity="center_horizontal"
tools:text="Target 189/lead by 100"
/>
</LinearLayout>
</android.support.v7.widget.CardView>
<TextView
android:paddingTop="30dp"
android:layout_below="#+id/card_view"
android:id="#+id/match_preview_summary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="10"
android:textColor="#android:color/black"
android:ellipsize="end"
android:textSize="15sp"
android:text="Description of the match thats about to start cause people love to read "/>
</RelativeLayout>
ScreenShot from android studio
That's how the image is in the android studio but only the cardViews are being displayed on the phone and not the TextView with id android:layout_below="#+id/card_view"
Using LinearLayout doesn't help too.
Changing android:layout_height="wrap_content" in the parent RelativeLayout gives the same result
All the contents of the CardView are displayed
If android:layout_below="#+id/card_view" is removed the TextView is displayed behind the CardView
You should only have one child group view in Card View so make LinearLayout or RelativeLayout as a parent layout in your CardView like below layout
<android.support.v7.widget.CardView
android:id="#+id/card_view"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="210dp"
card_view:cardBackgroundColor="#color/color_white"
card_view:cardCornerRadius="10dp"
card_view:cardElevation="5dp"
card_view:cardUseCompatPadding="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal">
<TextView
android:id="#+id/match_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15sp"
android:paddingStart="30dp"
android:paddingTop="10dp"
tools:text="2nd ODI"/>
<TextView
android:id="#+id/match_series_separator"
android:layout_toRightOf="#+id/match_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15sp"
android:paddingTop="10dp"
android:paddingStart="5dp"
android:text="-"
/>
<TextView
android:id="#+id/series_name"
android:layout_toRightOf="#+id/match_series_separator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15sp"
android:paddingStart="5dp"
android:paddingTop="10dp"
tools:text="India Tour of SriLanka,5 ODIs,2010"
/>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp">
<ImageView
android:id="#+id/team_logo_1"
android:tag="image_tag"
android:layout_alignParentStart="true"
android:layout_width="65dp"
android:layout_height="100dp"
android:layout_margin="5dp"
android:src="#drawable/matches"/>
<TextView
android:id="#+id/score_team_1"
android:layout_centerVertical="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20sp"
tools:text="100/3"
android:layout_toEndOf="#+id/team_logo_1"/>
<TextView
android:id="#+id/overs_team_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20sp"
android:paddingTop="50dp"
android:paddingStart="15dp"
tools:text="20"
android:layout_centerVertical="true"
android:layout_toEndOf="#+id/team_logo_1" />
<ImageView
android:id="#+id/team_logo_2"
android:layout_alignParentEnd="true"
android:tag="image_tag"
android:layout_width="65dp"
android:layout_height="100dp"
android:layout_margin="5dp"
android:src="#drawable/matches"/>
<TextView
android:id="#+id/score_team_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:textSize="20sp"
tools:text="100/3"
android:layout_toStartOf="#+id/team_logo_2"/>
<TextView
android:id="#+id/overs_team_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/score_team_2"
android:layout_centerVertical="true"
android:textSize="20sp"
android:paddingTop="50dp"
android:paddingEnd="15dp"
android:layout_toStartOf="#+id/team_logo_2"
tools:text="20"/>
</RelativeLayout>
<TextView
android:id="#+id/match_status_result"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
tools:text="Match in progress/ India won by 3 wickets"/>
<TextView
android:id="#+id/target_leadby"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="10dp"
android:layout_gravity="center_horizontal"
tools:text="Target 189/lead by 100"
/>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>