自定义控件
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;
}
}
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。