首页 > 解决方案 > android - 滑动按钮找不到属性的资源标识符

问题描述

我正在尝试使用 com.ebanx.swipebtn.SwipeButton 提供的滑动按钮

在我的应用程序中

compile 'com.ebanx:swipe-button:0.2.1'

在我的 xml 布局中

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout android:layout_width="match_parent"
    android:layout_height="wrap_content"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    tools:layout_editor_absoluteX="8dp"
    tools:layout_editor_absoluteY="8dp"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:android="http://schemas.android.com/apk/res/android">

    <com.ebanx.swipebtn.SwipeButton
        android:id="@+id/button"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginEnd="20dp"
        android:layout_marginStart="20dp"
        android:layout_marginBottom="20dp"
        app:button_image_disabled="@drawable/ic_lock_open_black_24dp"
        app:button_image_enabled="@drawable/ic_lock_outline_black_24dp"
        app:button_background="@drawable/shape_button"
        app:button_image_height="60dp"
        app:button_image_width="100dp"
        app:button_bottom_padding="18dp"
        app:button_left_padding="38dp"
        app:button_right_padding="38dp"
        app:button_top_padding="18dp"
        app:initial_state="disabled"
        app:inner_text="Enable"
        app:inner_text_background="@drawable/shape_rounded"
        app:inner_text_color="@android:color/white"
        app:inner_text_size="16sp"
        app:inner_text_top_padding="18dp"
        app:inner_text_bottom_padding="18dp" />

尝试构建时,我收到错误消息,提示找不到以应用程序前缀开头的属性的资源标识符,这些属性特定于滑动按钮视图。

我尝试像这样添加 xmlns 应用程序

<com.ebanx.swipebtn.SwipeButton   
    xmlns:app="http://schemas.android.com/apk/lib/com.ebanx"
    .....
    ..... />

但是当我运行应用程序时,滑动按钮不显示。

标签: javaandroidbuttonswipe

解决方案


推荐阅读