【发布时间】:2020-06-10 01:09:08
【问题描述】:
为了显示一个带圆角的 webview,我将它放在 CardView 中,结果如预期的那样,一个带圆角的 webview。
但是在lollipop 上测试应用程序时,边角不是圆角的,只显示了一个简单的 web 视图。如何在lollipop 上修复它?
更新:代码如下:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/root"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#222222"
android:clickable="true">
<androidx.cardview.widget.CardView
android:id="@+id/card_holder"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:layout_marginLeft="25dp"
android:layout_marginTop="50dp"
android:layout_marginRight="25dp"
android:layout_marginBottom="50dp"
app:cardCornerRadius="30dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.cardview.widget.CardView
android:id="@+id/top_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#FFFFFF"
android:clickable="true"
app:cardElevation="10dp">
<RelativeLayout
android:id="@+id/page_address"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_alignParentTop="true"
android:layout_margin="10dp"
android:background="@drawable/round_edge">
<TextView
android:id="@+id/address_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_marginLeft="45dp"
android:layout_marginRight="45dp"
android:drawablePadding="2dp"
android:ellipsize="end"
android:lines="1"
android:textColor="#000000"
android:textSize="14dp" />
</RelativeLayout>
</androidx.cardview.widget.CardView>
<WebView
android:id="@+id/webview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/top_bar"
android:scrollbars="none" />
</RelativeLayout>
</androidx.cardview.widget.CardView>
【问题讨论】:
-
添加您当前尚未工作的源代码。
-
你在 app.gradle 中的目标 sdk 和 minsdk 是什么
-
@sashabeliy min:21 目标:29
标签: android webview material-design android-cardview