Hey Guys i have a Question about how to make a button randomly move every second
the black tiles are a button
so i want to make it move randomly in every second or more fast
this is my xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://ift.tt/nIICcg"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/backgroundblank" >
<Button
android:id="@+id/Button01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/black1" />
</RelativeLayout>
this is the code
public class tested extends Activity {
Button buttonblack;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.tested);
buttonblack = (Button)findViewById(R.id.black1);
buttonblack.setOnClickListener(new View.OnClickListener() {
public void onClick(View v){
//if the button clicked
//Do some logic here
}
});
}
anyone can help me?
Aucun commentaire:
Enregistrer un commentaire