布局文件:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.track.StaticTrackView
android:id="@+id/staticTrackView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"/>
<com.track.DynamicTrackView
android:id="@+id/dynamicTrackView1"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>FrameLayout中有两个自定义图形,一个是静态的图像,另一个是动态的图形; 顾名思义静态的图像是不需要时时更新的,而动态的图像随着时间的变化会有所变化, 现在的问题是我在更新(View.invalidate())动态图像的时候静态的图像也会跟着更新,这是为什么啊?
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.track.StaticTrackView
android:id="@+id/staticTrackView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"/>
<com.track.DynamicTrackView
android:id="@+id/dynamicTrackView1"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>FrameLayout中有两个自定义图形,一个是静态的图像,另一个是动态的图形; 顾名思义静态的图像是不需要时时更新的,而动态的图像随着时间的变化会有所变化, 现在的问题是我在更新(View.invalidate())动态图像的时候静态的图像也会跟着更新,这是为什么啊?
解决方案 »
- 需要给网站开发一个客户端
- 在facebook注册api失败,在填写验证码后,提示信息说我的时假账号,手机也验证过了,怎么办啊,就差这一步了
- 关于Notification铃声停止的问题?
- Android手机系统设置本机号码?
- FFmpeg压缩音频
- 有自己做或者打算出来做的吗,大家聊聊呀
- 我想在安卓系统上做一个udl连接,连接PC上的sql server 服务器
- 如何在ListPreference中改变AlertDialog的文字大小?
- 用手机搭建了一个web服务器 可是只能通过路由访问 如何利用gprs访问
- Android中设了4个按钮,却只有一个能用 求大神指点
- android_人人 sdk的使用方法
- 一个关于setOnTouchListener的小问题
/**
* Invalidate the whole view. If the view is visible, {@link #onDraw} will
* be called at some point in the future. This must be called from a
* UI thread. To call from a non-UI thread, call {@link #postInvalidate()}.
*/
public void invalidate() {
if (ViewDebug.TRACE_HIERARCHY) {
ViewDebug.trace(this, ViewDebug.HierarchyTraceType.INVALIDATE);
} if ((mPrivateFlags & (DRAWN | HAS_BOUNDS)) == (DRAWN | HAS_BOUNDS)) {
mPrivateFlags &= ~DRAWN & ~DRAWING_CACHE_VALID;
final ViewParent p = mParent;
final AttachInfo ai = mAttachInfo;
if (p != null && ai != null) {
final Rect r = ai.mTmpInvalRect;
r.set(0, 0, mRight - mLeft, mBottom - mTop);
// Don't call invalidate -- we don't want to internally scroll
// our own bounds
p.invalidateChild(this, r);
}
}
}
执行DynamicTrackView对象的invalidate()可以不?
http://source.android.com/source/downloading.html