ImageView iv = (ImageView)findViewById(R.drawable.icon);
Bitmap bm = BitmapFactory.decodeResource(getResources(), R.drawable.icon);
iv.setImageBitmap(bm);xml布局文件<ImageView android:src="@drawable/icon"
android.layout_width="wrap_content"
android.layout_height="wrap_content">
</ImageView>
一直报fc错误。不知道 该怎么解决
解决方案 »
- andEngine,scene切换问题!!求大神
- 求助:java.lang.NoClassdefFoundError:org.apache.cxf.jaxws.JaxWsProxyFactoryBean错误
- Thread.sleep() 问题
- eclipse有类似visual studio的“书签”功能吗?
- Android TCP Socket真机上连接失败
- 帮忙推荐一两本好点的教材
- 根据应用程序包名获取应用icon
- webView显示flash 很模糊的问题
- 手机开发大杂烩
- android dialog弹出位置能不能在输入法之上
- 所有activity失去焦点时才启动另一个activity
- [求助]如何在view上添加滚动条
android.layout_width="wrap_content"
android.layout_height="wrap_content">
</ImageView>还是报错。一启动就报错,还没走到上面的响应代码
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="100dip">
<Button android:id="@+id/Button01"
android:text="@string/click_me"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</Button>
<ImageView android.id="@+id/imageView"
android.layout_width="wrap_content"
android.layout_height="wrap_content">
</ImageView>
</LinearLayout>如果把imageview去掉就没问题了。加上后一启动就有问题
ImageView iv = (ImageView)findViewById(R.id.imageView);
android.layout_width="wrap_content"
android.layout_height="wrap_content">
</ImageView>
是:号呀!!!!!!!
<ImageView android.id="@+id/imageView"
android.layout_width="wrap_content"
android.layout_height="wrap_content">
</ImageView>
第二修改程序代码:
ImageView iv = (ImageView)findViewById(R.id.imageView);
Bitmap bm = BitmapFactory.decodeResource(getResources(), R.drawable.icon);
iv.setImageBitmap(bm);