解决方案 »
- logcat 的log里面 没有内存堆栈的信息 。
- android应用中如何识别是X86芯片和arm芯片
- 怎么样实现双击屏幕的事件
- 关于图片的显示问题
- Android的SQLite不支持“中文表名”吗?
- 请问KeyEvent.KEYCODE中的哪个是表示小数点的?
- 如何代码注册一个service?不在AndroidManifest.xml里面配置!
- socket客户端运行在真机上报:error opening trace file: No such file or directory (2) Refusin
- 安卓开发 百度离线地图出错
- android wheelview滚轮实现有滑动效果
- Android Theme 更新主题问题
- 关于drawText 不同分辨率坐标问题
View parentView = findViewById(R.id.parent);
Button button = (Button) findViewById(R.id.button1);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
parentView.setBackgroundResource(R.drawable.imageName);
}
});
<?xml version="1.0"?>
<!--
Copyright (C) 2010 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
--><selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/btn_speak_pressed" />
<item android:state_selected="true" android:drawable="@drawable/btn_speak_selected" />
<item android:drawable="@drawable/btn_speak_normal" />
</selector>