标签:自定义控件
1,XML布局
<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" > <com.eduask.demo3.ui.UiTextView android:marqueeRepeatLimit="marquee_forever" android:ellipsize="marquee" android:layout_width="fill_parent" android:layout_height="wrap_content" android:singleLine="true" android:text="@string/hello_world" /> </RelativeLayout> |
2,Java代码
public class UiTextView extends TextView { public UiTextView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); // TODO Auto-generated constructor stub } public UiTextView(Context context, AttributeSet attrs) { super(context, attrs); // TODO Auto-generated constructor stub } public UiTextView(Context context) { super(context); // TODO Auto-generated constructor stub } @Override public boolean isFocused() { // TODO Auto-generated method stub return true; } } |
标签:自定义控件
原文地址:http://9882931.blog.51cto.com/9872931/1614159