【问题标题】:How to programmatically change tabContentStart value in code?如何以编程方式更改代码中的 tabContentStart 值?
【发布时间】:2018-08-31 12:02:34
【问题描述】:

我有这个可滚动的 TabLayout,其中 tabContentStart 在 XML 中设置为 57dp 偏移量。

<android.support.design.widget.TabLayout
    android:id="@+id/tabLayout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:tabContentStart="57dp"
    app:tabMode="scrollable" />

我现在要做的是在一些 if/else 语句中更改代码中的这个值?

我不知道如何实现这一点。在 TableLayout 类中似乎没有等效的方法。

提前感谢您的帮助。

【问题讨论】:

标签: android android-tablayout android-tabs


【解决方案1】:

您可以使用 setPadding 或 setTranslationX 来获得想要的效果。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-11-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-12-10
    相关资源
    最近更新 更多