rt
解决方案 »
- 以下是软件行业前100名,你愿意选择哪一家做android开发
- 一个Animation 两个View 显示动画不同步
- 请问textview可以设置字体的粗体 斜体吗?
- 如何获得某种颜色的int值?
- 手机下载apk文件必须经过我的JSP,为什么下载后无法打开
- Android JNI通信(java byte与c++ char变换)
- MediaMetadataRetriever类的setDatasource问题
- 全屏的时候,软键盘上弹,界面往上移,如何解决这问题
- 如何实现开机自启动服务?
- 动态设置TextView字体大小问题
- 如何做到在wifi连接建立的时候自动启动一个进程?
- ontouch事件的几个问题
Returns the bitmap in which this view drawing is cached. The returned bitmap is null when caching is disabled. If caching is enabled and the cache is not ready, this method will create it. Calling draw(android.graphics.Canvas) will not draw from the cache when the cache is enabled. To benefit from the cache, you must request the drawing cache by calling this method and draw it on screen if the returned bitmap is not null.看了一下LS说的方法 , 应该可行 , 学习了。
代码如下:
View view =null;//这一部分怎样获取
if(view.isDrawingCacheEnabled()==false){
view.setDrawingCacheEnabled(true);
android.graphics.Bitmap bitmap=view.getDrawingCache();
}在线等
楼主请说明白点 !
求教!!!
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View layout = inflater.inflate(R.layout.main, null); View view = (View) layout;
if (view.isDrawingCacheEnabled() == false)
view.setDrawingCacheEnabled(true);
Bitmap bitmap = view.getDrawingCache();
return bitmap;运行代码时出现空指针异常,求解????
2. 直接使用findViewByID(R.id.a)就OK了
运行到这儿不能找到资源。source not find .不知道为什么,求解,急急急!!!
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/test"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
<Button android:id="@+id/start"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="start"/>
<Button android:id="@+id/stop"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="stop"/>
</LinearLayout>比如在这段xml里面,只需要View view = findViewById(R.id.test);
view.setDrawingCacheEnabled(true);
Bitmap bitmap = view.getDrawingCache();
Bitmap bit = Bitmap.createBitmap(view.getWidth(), view.getHeight(), Bitmap.Config.ARGB_8888);
Canvas c = new Canvas(bit);
view.draw(c);