Actually i am working on a layout in which i have to put CardView on a ImageView and it only covers the half portion of a ImageView and also add one TextView(Check Attach Image).
Note:
- I tried using FrameLayout and also with Relative Layout... and i achieved it but i don't think its a correct way because i hardcoded mostly paramters.
xml code :
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/toolbar">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<ImageView
android:layout_width="match_parent"
android:layout_height="170dp"
android:layout_gravity="center"
android:background="@drawable/background"
android:id="@+id/picture">
</ImageView>
<TextView
android:text="TEXT VIEW"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="149dp"
android:layout_marginStart="149dp"
android:layout_marginTop="24dp"
android:id="@+id/textView" />
</FrameLayout>
</LinearLayout>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="120dp"
app:cardBackgroundColor="@color/textViewBackground"
card_view:cardUseCompatPadding="true"
android:layout_centerHorizontal="true"
card_view:cardElevation="15sp"
android:layout_marginTop="153dp" />