While running application layout not displaying properly
I am trying to show author text view below the quote text view
but it's not working
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:background="@color/black"
tools:context=".PreviewActivity">
<RelativeLayout
android:id="@+id/lnimg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/contact_number"
android:layout_centerInParent="true">
<ImageView
android:id="@+id/imgquote"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/quote"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="@dimen/album_title_padding"
android:paddingRight="@dimen/album_title_padding"
android:textColor="@color/white"
android:text="Quotes"
android:layout_centerInParent="true"
android:gravity="center_horizontal"
android:typeface="serif"
android:textSize="@dimen/_15sdp" />
<TextView
android:id="@+id/author"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="end"
android:layout_below="@+id/quote"
android:paddingRight="@dimen/album_title_padding"
android:text=" -Author"
android:textColor="@color/white"
android:textSize="@dimen/_15sdp" />
</RelativeLayout>
<ImageView
android:id="@+id/imgsave"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/circle"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_margin="@dimen/_5sdp"
android:padding="@dimen/_5sdp"
android:clickable="true"
android:src="@drawable/ic_download"/>
</RelativeLayout>
I've done this type of layout before but it's not working now
I am getting this output
Any help would be highly appreciated.
solve the problem
Just move Textview in vertical LinearLayout
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:orientation="vertical">
<TextView
android:id="@+id/quote"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="@dimen/album_title_padding"
android:paddingRight="@dimen/album_title_padding"
android:paddingTop="@dimen/album_title_padding"
android:gravity="center_horizontal"
android:textColor="@color/white"
android:text="Quotes"
android:typeface="serif"
android:textSize="@dimen/_15sdp" />
<TextView
android:id="@+id/author"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="end"
android:paddingLeft="@dimen/album_title_padding"
android:paddingRight="@dimen/album_title_padding"
android:paddingTop="@dimen/album_title_padding"
android:layout_marginTop="@dimen/_10sdp"
android:layout_marginBottom="@dimen/_5sdp"
android:text=" -Author"
android:textColor="@color/white"
android:textSize="@dimen/_15sdp" />
</LinearLayout>