ボタンの背景リソースを削除する方法これを参照しましたが、ボタンの背景を削除する必要があり、deviceDefaultテーマに従って背景を変更する必要があります。新しいリソースを割り当てるのではなく、前回追加したリソースを単に削除することを意味します。
誰でもこの問題を解決するのを助けることができますか? ありがとうございました
ボタンの背景リソースを削除する方法これを参照しましたが、ボタンの背景を削除する必要があり、deviceDefaultテーマに従って背景を変更する必要があります。新しいリソースを割り当てるのではなく、前回追加したリソースを単に削除することを意味します。
誰でもこの問題を解決するのを助けることができますか? ありがとうございました
try assigning background:@null in xml file for programetically try layout.setBackgroundResource(0);
これを行うには、バックグラウンド リソースを変更します。ボタンの属性用の XML ファイル。
<Button
...
android:background="@null" />
やるべきです。
If you're only doing this a few times, a simple way is to just save the previous background before altering it. You can store it in the tag
field of the Button:
//store previous background drawable
myButton.setTag(myButton.getBackground());
// ... alter background, do whatever
//restore background drawable from tag
myButton.setBackground((Drawable)myButton.getTag());
Button b;
b=(Button)findViewById(R.id.button1);
b.setBackgroundResource(R.drawable.ic_launcher);
b.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
b.setBackgroundResource(android.R.drawable.btn_default);
}
});
これはあなたを助けるはずです