小编Uno*_*uny的帖子

活动恢复时,Android自定义视图onVisibilityChanged调用

我为自动动画创建了自定义布局,无论它可见还是消失。这是我的代码:

public class DidiRelativeLayout extends RelativeLayout {
private AnimUtils animUtils;
private int animVisible, animGone, durVisible, durGone;
public DidiRelativeLayout(Context context) {
    super(context);
    animUtils = AnimUtils.getInstance(context);
}

public DidiRelativeLayout(Context context, AttributeSet attrs) {
    super(context, attrs);
    animUtils = AnimUtils.getInstance(context);
    TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.DidiRelativeLayout, 0, 0);
    try {
        animVisible = ta.getInteger(R.styleable.DidiRelativeLayout_anim_visible, -1);
        animGone = ta.getInteger(R.styleable.DidiRelativeLayout_anim_gone, -1);
        durVisible = ta.getInteger(R.styleable.DidiRelativeLayout_anim_visible_duration, AttributeConst.DEFAULT_DURATION_ANIMATION);
        durGone = ta.getInteger(R.styleable.DidiRelativeLayout_anim_gone_duration, AttributeConst.DEFAULT_DURATION_ANIMATION);
    } finally {
        ta.recycle();
    }
}

public DidiRelativeLayout(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    animUtils = …
Run Code Online (Sandbox Code Playgroud)

android android-custom-view

2
推荐指数
1
解决办法
1163
查看次数

空JDateChooser

我正在使用JDateChooser作为Javaapp(这是我第一次使用它).当JDateChooser为空时,我希望通过以下代码来捕获错误:

if(dcs1.getDate().toString().isEmpty()){
       lblOk.setText("Empty");
   }else{
    Date d = dcs1.getDate();
    DateFormat df = new SimpleDateFormat("MM-dd-yyyy");
    String t = df.format(d);
    lblOk.setText(t);
   }
JLabel lblOk;
JDateChooser dcs1;
Run Code Online (Sandbox Code Playgroud)

但它不起作用.Any1可以帮助我.

java jdatechooser

0
推荐指数
2
解决办法
1万
查看次数

标签 统计

android ×1

android-custom-view ×1

java ×1

jdatechooser ×1