首页 > 其他 > 详细

自定义控件

时间:2015-02-13 01:42:31      阅读:276      评论:0      收藏:0      [点我收藏+]

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!