繁体   English   中英

如何在android中设置带有圆角的阴影边框(仅使用开源)

[英]how to set shadow border with round corners in android (using open source only)

我想创建一个像这样的容器:

在此处输入图片说明

我已经试过了:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
    android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:orientation="vertical"
    tools:context=".MainActivity$PlaceholderFragment"
    android:weightSum="1">



    <ImageView
        android:layout_width="match_parent"
        android:layout_height="100dip"
        android:src="@android:drawable/alert_dark_frame"
        android:id="@+id/textView1"
        android:gravity="center"
        android:background="#152"/>

    <TextView
        android:layout_width="match_parent"
        android:layout_height="10dip"
        android:text="New Text"
        android:textColor="#FFFFFF"
        android:id="@+id/textView2"
        android:background="#120"
        android:gravity="center"
        android:layout_weight="0.07" />

    <TextView
        android:layout_width="match_parent"
        android:layout_height="30dip"
        android:text="--"
        android:textSize="30dp"
        android:id="@+id/textView3"
        android:gravity="center"
        android:layout_weight="0.88" />



</LinearLayout>

这是我的输出:

在此处输入图片说明

如何创建阴影边框和圆角?

我希望拐角位于整个容器周围,而不是分别放在每个shape \\ color上。

所以我需要用户“上”和“下”角?

您可以尝试使用库来创建带有阴影的漂亮布局。 在这里尝试这个。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM