tnx寻求帮助
我的代码:
b = new Button(MainActivity.this);
b.setBackgroundResource(R.drawable.round_button);
b.setLayoutParams(new LinearLayout.LayoutParams(100, 100));
b.setText(String.valueOf(values.get(i).getTable_number()));
b.setTag(values.get(i).getTable_number());
b.setId(values.get(i).getTable_number());
// RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(100, 100);
float x =values.get(i).getX();
float y =values.get(i).getY();
System.out.println("check place " + x+y);
// b.setX(x);
// b.setY(y);
MultiTouchListener touchListener = new MultiTouchListener(MainActivity.this);
b.setOnTouchListener(touchListener);
main.addView(b);//show button
View draggableView = b;//the button can move
draggableView.setOnTouchListener(MainActivity.this);
tableInfo.close();