以下是我从Github
实现ShapeOfView
库后的简单xml
布局文件
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="10">
<com.github.florent37.shapeofview.shapes.DiagonalView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="4"
android:elevation="4dp"
app:shape_diagonal_angle="6"
app:shape_diagonal_direction="right"
app:shape_diagonal_position="bottom">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="centerCrop"
android:src="@drawable/homepage" />
</com.github.florent37.shapeofview.shapes.DiagonalView>
但是当我调试它的时候,我得到了这个错误:
Android resource linking failed
/home/.../fragment_home.xml:9: error: attribute shape_diagonal_direction not found.
error: failed linking file resources.
为什么会这样呢?
发布于 2020-07-10 17:19:43
我刚刚删除了那个Attribute(app:shape_diagonal_direction="right"),,它对我很有效!使用此代码。
<com.github.florent37.shapeofview.shapes.DiagonalView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="4"
android:elevation="4dp"
app:shape_diagonal_angle="6"
app:shape_diagonal_position="bottom">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="centerCrop"
android:src="@drawable/homepage" />
</com.github.florent37.shapeofview.shapes.DiagonalView>
发布于 2021-05-08 02:31:57
只需删除该行,问题是因为库版本,它只是删除了该属性。
它必须是这样的:
<com.github.florent37.shapeofview.shapes.DiagonalView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="4"
android:elevation="4dp"
app:shape_diagonal_angle="6"
app:shape_diagonal_position="bottom">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="centerCrop"
android:src="@drawable/homepage" />
</com.github.florent37.shapeofview.shapes.DiagonalView>
https://stackoverflow.com/questions/57238819
复制相似问题