代码之家  ›  专栏  ›  技术社区  ›  Dominik

如何以编程方式更改代码中的tabContentStart值?

  •  0
  • Dominik  · 技术社区  · 6 年前

    我有一个可滚动的表格布局,其中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类中似乎没有类似的方法。

    提前谢谢你的帮助。

    0 回复  |  直到 6 年前
        1
  •  0
  •   Milind Chaudhary    4 年前

    可以使用setPadding或setTranslationX来获得所需的效果。