首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Android-webview在cardview中,棒棒糖上没有圆角

Android-webview在cardview中,棒棒糖上没有圆角
EN

Stack Overflow用户
提问于 2020-02-26 15:56:59
回答 1查看 461关注 0票数 3

为了显示带有圆角的webview,我将其放入一个CardView中,结果正如预期的那样,是一个带有圆角的webview。

但当在lollipop上测试应用程序时,这些角并不是圆角,只显示了一个简单的when视图。如何在lollipop上修复它

更新:代码如下:

代码语言:javascript
复制
<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>

EN

回答 1

Stack Overflow用户

发布于 2020-02-26 20:21:05

在您的app.gradle中进行如下更改

代码语言:javascript
复制
compileSdkVersion 29
minSdkVersion 15
        targetSdkVersion 29

和同步项目

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60409204

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档