【问题标题】:Material Design TabLayout - tabIndicatorAnimationMode not foundMaterial Design TabLayout - 未找到 tabIndicatorAnimationMode
【发布时间】:2021-02-28 23:06:11
【问题描述】:

我正在尝试从我的layout.xml 设置以下docs 中描述的选项卡属性。

我说的属性是tabIndicatorAnimationModewitch应该有2个选项; linearelastic。如果我在 attrs.xml 文件中的 github 中搜索,我会找到它们:

<attr name="tabIndicatorAnimationMode">
      <!-- Animate the selection indicator's left and right bounds in step with
           each other. -->
      <enum name="linear" value="0"/>
      <!-- Animate the selection indicator's left and right bounds out of step
           with each other, decelerating the front and accelerating the back.
           This causes the indicator to look like it stretches between destinations
           an then shrinks back down to fit the size of it's target tab. -->
      <enum name="elastic" value="1"/>
</attr>

我是如何实现它的:

<com.google.android.material.tabs.TabLayout
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      app:tabIndicatorAnimationMode="elastic">

我使用什么版本的材料设计?(目前最新版本在maven

implementation 'com.google.android.material:material:1.3.0-alpha03'

我会遇到什么错误?

layout.xml:63: AAPT: error: attribute tabIndicatorAnimationMode not found.

【问题讨论】:

    标签: android android-layout material-design android-tablayout android-tabs


    【解决方案1】:

    尝试将您的版本升级到

    implementation 'com.google.android.material:material:1.4.0-beta01'
    

    【讨论】:

      【解决方案2】:

      您使用的版本不包含该属性。 使用以下稳定版本以获得访问权限。

      implementation 'com.google.android.material:material:1.5.0-alpha01'
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2019-08-24
        • 1970-01-01
        • 1970-01-01
        • 2017-02-23
        • 1970-01-01
        • 2015-01-31
        • 2021-04-23
        • 2021-10-19
        相关资源
        最近更新 更多