This is my xml code i want keep center Textview
inside linear layout which contain textview
and view but i want text view shout center in linear layout bottom to view i.e button textview
should center from top view and bottom linearLayout
.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/no_vouchers_view"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.CardView
android:id="@+id/xxlayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/header_height"
android:visibility="gone"
tools:visibility="visible">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="@dimen/margin_12"
android:orientation="vertical">
<TextView
android:id="@+id/xxmessage"
style="@style/Typeface.Body.TextMidGrey"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:lineSpacingExtra="@dimen/tfl_6"
tools:text="KJGSAHJDGJKSGDASAGDHJGAS" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="@dimen/margin_16"
android:background="@color/text_light_grey" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/button"
style="@style/Typeface.Body.Bold.White"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_16"
android:paddingBottom="@dimen/padding_12"
android:paddingTop="@dimen/padding_12"
android:background="@drawable/welcome_screen_button_selector"
android:layout_centerHorizontal="true"
android:layout_gravity="center"
android:gravity="center"
android:text="@string/convert_points_to_vouchers"
android:textAllCaps="false" />
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</RelativeLayout>