赞
踩
1:第一个类是自定义的一个类 也就是SeekBar上方会跟随其一块移动的控件,其实非常简单的一个类
package com.example.textmovebyseekbar;
import android.content.Context;
import android.util.AttributeSet;
import android.view.ViewGroup;
//import android.widget.AbsoluteLayout;
public class TextMoveLayout extends ViewGroup {
public TextMoveLayout(Context context) {
super(context);
// TODO Auto-generated constructor stub
}
public TextMoveLayout(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
// TODO Auto-generated constructor stub
}
public TextMoveLayout(Context context, AttributeSet attrs) {
super(context, attrs);
// TODO Auto-generated constructor stub
}
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
// TODO Auto-generated method stub
}
}
2: 第二类就是MainActivity了,代码很简单!稍微看下就懂的了~
package com.example.textmovebyseekbar;
import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.view.ViewGroup;
import android.widget.SeekBar;
import android.widget.TextView;
public class MainActivity extends Activity {
private SeekBar seekbar = null;
private String startTimeStr = "19:30:33";
private String endTimeStr = "21:23:21";
private TextView text, startTime, endTime;
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。