I am using this code to move and resize the button in a relative layout...
Program crashes when I touch on the screen, what can be the reason.?
var vfs = require('vinyl-fs');
gulp.task('myTask', [], function() {
vfs.src('static/img/**/*')
.pipe(vfs.dest('dist/img'))
)};
I have tried making relative layout as just RelativeLayout type instead of ViewGroup, still didnot work. Guidance,...thank you in advance..
ViewGroup relativeL;
onCreate(){
relativeL = (ViewGroup) findViewById(R.id.relativeLayout);
relativeL.setOnTouchListener(new RelativeLayout.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
methodMove();
return true;
}
});
}
public void methodMove(){
View button = findViewById(R.id.helloButton);
TransitionManager.beginDelayedTransition(relativeL);
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, RelativeLayout.TRUE);
layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE);
relativeL.setLayoutParams(layoutParams);
button.setLayoutParams(new RelativeLayout.LayoutParams(130,250));
}
答案 0 :(得分:0)
我是移动设备,我无法检查代码,但您可以尝试更改
button.setLayoutParams(new RelativeLayout.LayoutParams(130,250));
要
button.setLayoutParams(new FrameLayout.LayoutParams(130,250));