android-仿QQtab(8)
来源:未知 责任编辑:责任编辑 发表时间:2014-05-20 18:32 点击:次
break;
case R.id.tab3:
changeTop(layout3);
break;
default:
break;
}
}
private void changeTop(RelativeLayout relativeLayout){
ImageView old = (ImageView) relativeLayout.findViewWithTag("first");
select_width =old.getWidth();
select_height = old.getHeight();
RelativeLayout.LayoutParams rl = new RelativeLayout.LayoutParams(select_width, select_height);
rl.leftMargin = old.getLeft()+((RelativeLayout)old.getParent()).getLeft();
rl.topMargin = old.getTop()+((RelativeLayout)old.getParent()).getTop();
// 获取起始位置
firstLeft = old.getLeft()+((RelativeLayout)old.getParent()).getLeft();
ImageView iv = new ImageView(this);
iv.setTag("move");
iv.setImageResource(R.drawable.topbar_select);
layout.addView(iv,rl);
relativeLayout.removeView(old);
}
private OnClickListener listener = new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
if(!isAdd){
replace();// // 初次使用移除old 添加新的top_select为RelativeLayout所使用
isAdd = true;
}
ImageView top_select = (ImageView) layout.findViewWithTag("move");
int tabLeft = 0;
int endLeft=0;
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>