Android 如何在滚动时动态更改充气视图中文本的textcolor?

Android 如何在滚动时动态更改充气视图中文本的textcolor?,android,Android,我已将我的观点添加到相对论报告中 我想在滚动时动态更改此Textview颜色 我是说在 onScrollChanged() { -----------------------------------> I want to change my Textview color } 我试图改变,但没有思考。我想知道在向布局添加视图后是否可以更改textcolor 请提出建议。在提问之前,请用谷歌搜索你的问题。尝试使用tvTitle.invalidate()强制它在CrollShange

我已将我的观点添加到相对论报告中

我想在滚动时动态更改此Textview颜色

我是说在

  onScrollChanged()
{

----------------------------------->  I want to change my Textview color
}
我试图改变,但没有思考。我想知道在向布局添加视图后是否可以更改textcolor


请提出建议。

在提问之前,请用谷歌搜索你的问题。尝试使用tvTitle.invalidate()强制它在CrollShanged上重新绘制你的文本
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"

    tools:context=".MainActivity" >



    <ImageView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:id="@+id/iv_background"
        android:src="@drawable/new_bg"

         />

    <TextView 
         android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/tv_title"
        android:text="Hello"
        />

</RelativeLayout>
final View view= getActivity().getLayoutInflater().inflate(R.layout.inflated, null);
    iv1=(ImageView)view.findViewById(R.id.iv_background);
        tvTitle=(TextView)view.findViewById(R.id.tv_title);

        rl_flower.addView(view);
  onScrollChanged()
{

----------------------------------->  I want to change my Textview color
}