【问题标题】:Problems with setting the Text of a Chip within a ChipGroup在芯片组中设置芯片文本的问题
【发布时间】:2019-05-23 02:57:19
【问题描述】:

可能我的问题的解决方案非常简单,但显然我遗漏了一些东西,并且坚持自己修复它。

问题:

如果用户可以从 RecyclerView 过滤内容,我想要一个 ChipGroup,但不幸的是,我在尝试设置文本时遇到错误。

/home/noah/StudioProjects/.../app/src/main/res/layout/filter_dialog.xml:104: error: attribute text (aka [...]:text) not found.

代码:

<android.support.design.chip.ChipGroup
            android:id="@+id/chipGroup"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="8dp"
            app:layout_constraintTop_toBottomOf="@+id/box_m">

            <android.support.design.chip.Chip
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                app:text="Lab 1" />

            <android.support.design.chip.Chip
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                app:text="Lab 2" />

...

我已经尝试过的:

  • app:textapp:chipText之间切换

  • 添加 implementation group: 'com.google.android.material', name: 'material', version: '1.1.0-alpha02' 但这会导致我的 gradle 文件中的其他实现出现各种问题

依赖项

 {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.google.firebase:firebase-auth:16.1.0'
    implementation 'com.google.firebase:firebase-core:16.0.6'
    implementation 'com.google.firebase:firebase-database:16.0.5'
    implementation 'com.google.firebase:firebase-storage:16.0.5'
    implementation 'com.github.clans:fab:1.6.4'
    implementation 'com.crystal:crystalrangeseekbar:1.1.1'
    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
    implementation 'com.android.support:support-vector-drawable:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.github.esafirm.android-image-picker:imagepicker:1.13.0'
    implementation 'com.google.firebase:firebase-functions:16.1.3'
    implementation 'com.diogobernardino:williamchart:2.5.0'
    implementation 'com.github.bumptech.glide:glide:4.8.0'
    implementation 'com.firebaseui:firebase-ui-storage:4.1.0'
    implementation 'com.google.firebase:firebase-messaging:17.3.4'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
    testImplementation 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'

【问题讨论】:

  • 你尝试过 android:text 吗?

标签: android xml android-gradle-plugin material-design


【解决方案1】:

来自docs

android:text - 设置芯片的文本。

【讨论】:

    猜你喜欢
    • 2020-08-25
    • 1970-01-01
    • 1970-01-01
    • 2020-09-02
    • 1970-01-01
    • 2018-12-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多