Dan*_*hto 10 android android-framelayout
我在根视图中有一个FrameLayout(线性:垂直),我根据用户输入使用它来保存不同的片段.FrameLayout小于背景,因此它似乎是"浮动".
如何围绕FrameLayout的角落?
进入FrameLayout内部的碎片不是图片,所以我无法裁剪它们.
Mas*_*sum 22
创建一个xml文件,例如your_rounded_shape.xml,在drawable文件夹中,并添加以下代码:
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#CCCCCC"/>
<stroke android:width="2dp"
android:color="#999999"/>
<padding android:left="2dp"
android:top="2dp"
android:right="2dp"
android:bottom="2dp"/>
<corners android:bottomRightRadius="8dp"
android:bottomLeftRadius="8dp"
android:topLeftRadius="8dp"
android:topRightRadius="8dp"/>
</shape>
Run Code Online (Sandbox Code Playgroud)
然后your_rounded_shape.xml用作你的背景FrameLayout.像这样的东西:
<FrameLayout
android:width="match_parent"
android:height="wrap_content"
android:background="your_rounded_shape"/>
Run Code Online (Sandbox Code Playgroud)
用 CardView 布局替换 FrameLayout。
<android.support.v7.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:cardCornerRadius="8dp">
</android.support.v7.widget.CardView>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
11087 次 |
| 最近记录: |