I'm not able to get my view inside my CardView

137 Views Asked by At

Here I'm adding two different view in two different layout

  1. For Remote Video
  2. For Local Video But addview for local video doesn't fit under cardview as defined in xml file

When I tried to reduce the size of remote view to half of my screen like the image below the local video fits under cardview perfectly but when my remote view as match parent it disturbs my local video in cardview

Picture 1. When Remote Video as Match Parent When Remote Video as Match Parent

Picture 2. When Remote Video Size Decreased When Remote Video Size Decreased

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto">


    <RelativeLayout
        android:id="@+id/remoteVideo"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"/>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:paddingVertical="10dp"
        android:background="@drawable/vdo_top_back">

        <TextView
            android:id="@+id/remoteUser"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:text="Ayush"
            android:textColor="#1E1E1E"
            android:maxLines="1"
            android:layout_marginHorizontal="20dp"
            android:fontFamily="@font/open_sans"
            android:textSize="28sp"/>

        <TextView
            android:id="@+id/callState"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:text="Ringing"
            android:textColor="#1E1E1E"
            android:fontFamily="@font/open_sans"
            android:textSize="14sp"
            android:textAllCaps="true" />

        <TextView
            android:id="@+id/callDuration"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:text="00:00"
            android:textColor="#1E1E1E"
            android:fontFamily="@font/open_sans"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:textSize="13sp"/>
    </LinearLayout>

    <androidx.cardview.widget.CardView
        android:layout_width="150dp"
        app:cardCornerRadius="30dp"
        app:cardElevation="20dp"
        android:layout_alignParentRight="true"
        android:layout_height="200dp"
        android:layout_margin="10dp">
        <RelativeLayout
            android:id="@+id/localVideo"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"/>
    </androidx.cardview.widget.CardView>




    <RelativeLayout
        android:id="@+id/bottomPanel"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingHorizontal="15dp"
        android:background="@drawable/bottom_nav_back"
        android:layout_alignParentBottom="true">
        <de.hdodenhof.circleimageview.CircleImageView
            android:layout_width="70dp"
            android:layout_height="70dp"
            android:background="@drawable/callend_back"
            android:scaleType="centerCrop"
            android:padding="18dp"
            android:layout_marginTop="10dp"
            android:layout_marginBottom="10dp"
            android:layout_centerHorizontal="true"
            android:id="@+id/hangupButton"
            android:src="@drawable/ic_baseline_call_end_24"/>
        <RelativeLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            android:layout_marginVertical="10dp"
            android:layout_below="@+id/hangupButton">
            <de.hdodenhof.circleimageview.CircleImageView
                android:layout_width="45dp"
                android:layout_height="45dp"
                android:background="?selectableItemBackground"
                android:layout_alignParentLeft="true"
                android:src="@drawable/ic_baseline_volume_up_24"/>
            <de.hdodenhof.circleimageview.CircleImageView
                android:layout_width="45dp"
                android:layout_height="45dp"
                android:layout_centerHorizontal="true"
                android:background="?selectableItemBackground"
                android:src="@drawable/ic_baseline_videocam_off_24"/>
            <de.hdodenhof.circleimageview.CircleImageView
                android:layout_width="45dp"
                android:layout_height="45dp"
                android:background="?selectableItemBackground"
                android:layout_alignParentRight="true"
                android:src="@drawable/ic_baseline_mic_off_24"/>
        </RelativeLayout>

    </RelativeLayout>



</RelativeLayout>
remoteview.addView(rview)
localView.addView(lview)

Thanks in Advance

0

There are 0 best solutions below