【问题标题】:how to create inside curve using relative or linear layout in android如何在android中使用相对或线性布局创建内部曲线
【发布时间】:2020-01-16 11:23:45
【问题描述】:

如何在android布局中创建这个我尝试了很多方法,但我没有找到任何方法来做到这一点

<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="100000dp" />
<solid android:color="#5fb0c9" />
<stroke
    android:width="-5dip"
    android:color="#3da8c9" />
<padding
    android:bottom="-4dp"
    android:left="-4dp"
    android:right="-4dp"
    android:top="-4dp" />

【问题讨论】:

  • 可以在视图中添加edge 吗?
  • 会是这个样子吗? @阿里

标签: android xml material-components-android android-shapedrawable


【解决方案1】:

您可以使用MaterialCardView 并应用ShapeAppearanceModel

类似:

  TriangleEdgeTreatment edgeTreatment = new TriangleEdgeTreatment(getResources().getDimension(R.dimen.cutout_size),true);

  cardView.setShapeAppearanceModel(cardView.getShapeAppearanceModel()
      .toBuilder()
      .setTopEdge(edgeTreatment)
      .build());

【讨论】:

  • 我只想在 xml 文件中使用
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-12-22
  • 2012-12-17
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多