Android 给WebView设置圆角
记录一下开发中遇到的WebView设置圆角的问题,网上都是以自定义WebView实现的,这样耦合性太强了,使用不方便;
由于WebView的特殊性,用普通的设置方式不起作用,可以用CardView作为WebView的父布局,通过设置CardView的圆角来达到院校效果的目的;
<androidx.cardview.widget.CardView
android:id="@+id/flLayout"
android:layout_="match_parent"
android:layout_height="0dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:cardCornerRadius="@dimen/dp10">
<WebView
android:id="@+id/webView"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</androidx.cardview.widget.CardView>
记录一下