我正在尝试随着时间的推移调整布局大小,我坚持的是试图循环缩小/增加大小,我目前正在努力调整屏幕大小。
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
DisplayMetrics displaymetrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
height = displaymetrics.heightPixels;
width = displaymetrics.widthPixels;
// Gets linearlayout
layout = (RelativeLayout)findViewById(R.id.relativeOne);
params = layout.getLayoutParams();
params.height = width - width/2;
params.width = width - width/2;
sizeAfter = width;
}
@Override
public boolean onTouchEvent(MotionEvent event)
{
sizeAfter = sizeAfter - 2;
params.height = sizeAfter;
params.width = sizeAfter;
return super.onTouchEvent(event);
}
目前这个工作正常,但是如何在一段时间后逐渐减少布局大小后实现定时器循环。