1
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/go"
android:text="go"
/>
我想在線性佈局中的按鈕下方添加一個圓。我該怎麼做?需要對main.xml進行哪些更改?如何在Android中單擊按鈕時繪製圓形?
public class SomeActivity extends Activity {
private Button checkButton;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
start();
}
private void start() {
checkButton=(Button)findViewById(R.id.go);
checkButton.setOnClickListener(new View.OnClickListener(){
public void onClick(View v){
}
});
}
需要在onClick方法中填寫什麼?
感謝u.but什麼必須配置的價值? @Marko Niciforovic – srk 2013-03-27 10:32:43
我編輯了我的答案,現在你有所有的價值。您可以根據自己的需要修改圓形的繪畫(顏色)和其他值。 – 2013-03-27 10:37:09
它沒有顯示任何錯誤,但它不工作 – srk 2013-03-27 10:48:36