By default, the following attributes are added to TextView: android: ellipsize = "marquee" android: focusableInTouchMode = "true" android: gravity = "center" android: marqueeRepeatLimit = "marquee_forever" android: scrollHorizontally = "true" android: singleLine = "true"
However, you will find that the code is invalid and the gridview cannot be clicked. Only the custom Textview code is as follows:
Package com. shangc. mycar. custom; import android. content. context; import android. util. attributeSet; import android. widget. textView;/*** custom textview achieves the effect of running the horse lights in the GridView. The isFocused () method in the view will not be effective by default, * You cannot click ** @ author dennis **/public class MyGridViewTextView extends TextView {public MyGridViewTextView (Context context, AttributeSet attrs, int defStyle) {super (context, attrs, defStyle );/ /TODO Auto-generated constructor stub} public MyGridViewTextView (Context context, AttributeSet attrs) {super (context, attrs);} @ Overridepublic boolean isFocused () {return true ;}} use the custom TextView above and remove android: focusable = "true.