android - 即使我找到了 shape_diagonal_direction 也没有找到

标签 android android-layout

以下是我从 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.

这是为什么?

最佳答案

我刚刚删除了该属性(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>

关于android - 即使我找到了 shape_diagonal_direction 也没有找到,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57238819/

相关文章:

android - 以编程方式访问 KNOX 计数器

android - 通过在 android 中增加 minSdk 版本我可以获得什么所有优势

java - ImageView 将可见性从消失更改为可见后不显示图像

android 开发者——你需要从设计师那里得到什么?

android - 我们应该在 Strings.xml 中还是在布局 xml 文件本身中给出字符串值

android - 如何让SupportMapFragment不填满屏幕高度

android - 如何让Android Activity出现在通知区域后面

android - Android 中的多个目录

android - 使用 Kotlin Android Extensions 以编程方式扩展布局

android - 覆盖 TextView 的文本大小