在我的Android项目中,我需要更改xml属性的颜色:app:footerColor="#1573D6"
在运行时动态更改。我怎样才能做到这一点?
在运行该应用程序时,我也可以更改布局,但是我一直在寻找方法,却找不到任何东西。
一些帮助将是巨大的。非常感谢你。
这是我的xml:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<com.viewpagerindicator.TitlePageIndicator
android:id="@+id/tabloid"
android:padding="10dip"
android:layout_height="40dp"
android:layout_width="fill_parent"
android:background="#000000"
android:textColor="#1573D6"
app:footerColor="#1573D6"
app:footerLineHeight="2dp"
app:footerIndicatorStyle="none"
app:selectedColor="#FFFFFF"
app:selectedBold="true" />
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1" />
您可以在代码中执行此操作:
TitlePageIndicator指标=(TitlePageIndicator)findViewById(R.id.yourview)
indicator.SetFooterColor(Color.parse(#1573D6))
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句