TextView textView = (TextView)findViewById(R.id.desc);
textView.setMovementMethod(ScrollingMovementMethod.getInstance());
textView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
// TODO Auto-generated method stub
if(event.getAction()==MotionEvent.ACTION_DOWN){
//通知父控件不要干扰
v.getParent().requestDisallowInterceptTouchEvent(true);
}
if(event.getAction()==MotionEvent.ACTION_MOVE){
//通知父控件不要干扰
v.getParent().requestDisallowInterceptTouchEvent(true);
}
if(event.getAction()==MotionEvent.ACTION_UP){
v.getParent().requestDisallowInterceptTouchEvent(false);
}
return false;
}
});
<TextView
android:id="@+id/desc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorTransparent"
android:gravity="left|top"
android:scrollbars="vertical"
android:textColor="@color/text_black"
android:textSize="@dimen/textsize14"/>
TextView scroll
Guess you like
Origin http://43.154.161.224:23101/article/api/json?id=326178913&siteId=291194637
Recommended
Ranking