I'm trying to make soften the corners of a LinearLayout. It works in portrait mode, but when I switch to landscape mode, it seems to ignore my background drawable file and doesn't have rounded corners. Any ideas why?
I've tried just about everything to get it to work. I've altered almost every line in the landscape activity_main.xml file, but every time I switch to landscape mode, the corners revert back to 0 radius. This is driving me crazy!
Your help is greatly appreciated.
activity_main.xml landscape:
<LinearLayout 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="horizontal"
tools:context=".MainActivity"
android:gravity="center"
android:background="@color/mainBackground">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp"
android:orientation="horizontal"
android:background="@color/background"
android:layout_gravity="center_vertical"
android:padding="10dp">
<LinearLayout
android:id="@+id/fragmentHolder"
android:layout_width="300dp"
android:layout_height="340dp"
android:orientation="horizontal"
android:layout_margin="10dp"
android:layout_gravity="center"
android:background="@drawable/rounded_corners_audio" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/background"/>
</LinearLayout>
</LinearLayout>
activity_main.xml portrait
<LinearLayout 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="wrap_content"
android:orientation="vertical"
tools:context=".MainActivity"
android:gravity="center"
android:background="@color/mainBackground">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp"
android:orientation="vertical"
android:background="@color/background"
android:layout_gravity="center_horizontal"
android:padding="10dp">
<LinearLayout
android:id="@+id/fragmentHolder"
android:layout_width="340dp"
android:layout_height="300dp"
android:orientation="vertical"
android:layout_margin="10dp"
android:layout_gravity="center"
android:background="@drawable/rounded_corners_audio"/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/background"/>
</LinearLayout>
</LinearLayout>
rounded_corners_audio.xml
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="10dp"/>
<solid android:color="@color/colorPrimary"/>
</shape>