在ChipGroup中设置芯片文本的问题

时间:2018-12-23 16:00:52

标签: android xml android-gradle material-design

解决我的问题的方法可能很简单,但是显然我缺少了某些东西,并且坚持自己解决问题。

问题:

我想拥有一个ChipGroup,以便用户可以从RecyclerView过滤内容,但是不幸的是,尝试设置文本时出现错误。

/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'

1 个答案:

答案 0 :(得分:0)

来自docs

  

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