android material design, cardview not added corner radius to phone

I have a Cardview inside android X

 <androidx.cardview.widget.CardView                 android:id="@+id/card_box_register"                 android:layout_width="match_parent"                 android:layout_height="360dp"                 android:layout_marginStart="16dp"                 android:layout_marginTop="226dp"                 android:layout_marginEnd="16dp"                 android:layout_marginBottom="16dp"                 card_view:cardBackgroundColor="@color/white"                 card_view:cardCornerRadius="36dp"                 card_view:cardElevation="8dp"/> 

On the surface, everything is fine and tidy, but when I export(apk) the application, none of the corner radius attributes apply to the card view. To understand more about this, you can look at the photos below apk android studio Preview

Add Comment
1 Answer(s)

This may be because you have set the hardware acceleration to false on the manifest(application level) or on the activity level ,if this is the case then add this piece of code to your manifest’s application tag

<application android:hardwareAccelerated="true" ...>

or in your activity level (in the manifest)

<application android:hardwareAccelerated="true"> <activity ... /> <activity android:hardwareAccelerated="false" /> 

have a look at the full documentation here

manifest.xml

    <application         android:name=".application"         android:allowBackup="true"         android:icon="@mipmap/ic_launcher"         android:label="@string/app_name"         android:roundIcon="@mipmap/ic_launcher_round"         android:supportsRtl="true"         android:hardwareAccelerated="true"         android:theme="@style/AppTheme">          <activity android:name=".activity.RegisterActivity" />          <activity             android:name=".activity.SplashActivity"             android:theme="@style/Splash">             <intent-filter>                 <action android:name="android.intent.action.MAIN" />                 <category android:name="android.intent.category.LAUNCHER" />             </intent-filter>         </activity>     </application> </manifest> 
Answered on July 17, 2020.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.