【发布时间】:2011-05-06 08:50:13
【问题描述】:
我在我的 XML 文件中定义了一个按钮。该按钮的工作方式与您所期望的完全一样……直到我在底部添加该行(android:background="drawable/leftarrow1")。然后按钮在 Activity 中不再可点击,但新的背景显示为我想要的。
什么给了?
<Button
android:id="@+id/switch_left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:background="@drawable/leftarrow1" />
这里是点击代码供参考
Button switchLeft = (Button) findViewById(R.id.switch_left);
switchLeft.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Log.w(this.getClass().getName(), "clicked left arrow");
}
});
【问题讨论】:
标签: java android xml button android-activity