长按后,我正在使用样式启动半透明活动。 问题在于,底部活动会得到触摸,直到用户从屏幕上抬起手指为止。在用户抬起手指并再次按下后,顶部的动作会得到触摸。 知道如何从一开始就使顶级活动受到影响吗?
b = document.createElement("DIV");
b.innerHTML = "<a href=\'" + arr[i].url + "\' target='_blank'><strong>" + arr[i].name.substr(0, val.length) + "</strong>" + arr[i].name.substr(val.length) + "</a>";
b.innerHTML += "<input type='hidden' value='" + arr[i].name + "'>";
b.addEventListener("click", function(e) {
inp.value = this.getElementsByTagName("input")[0].value;
closeAllLists();
});
我的活动:
<style name="Theme.Transparent">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@color/white</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowIsFloating">false</item>
<item name="android:backgroundDimEnabled">true</item>
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="android:windowAnimationStyle">@null</item>
</style>
在我的底部活动中,我有一个回收站视图,其中包含来自框架布局类型的视图。在框架布局中,我以这种方式打开第二个活动:
public class GroupDragForArchive extends BaseActivity {
private static final String DEBUG_TAG = "Gestures";
@Override
protected int getLayoutId() {
return R.layout.drag;
}
@Override
public boolean shouldBeLoggedInForActivity() {
return true;
}
@Override
public boolean shouldPollInActivity() {
return false;
}
@Override
protected void onCreated(Bundle savedInstanceState) {
}
public static void startActivity(Activity activity) {
Intent intent = new Intent(activity, GroupDragForArchive.class);
activity.startActivityForResult(intent, IntConst.RequestCodes.REQUEST_DRAG_FOR_ARCHIVE);
activity.overridePendingTransition(0, 0);
}
@Override
protected int getPayBoxTheme() {
return R.style.Theme_Transparent;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
int action = MotionEventCompat.getActionMasked(event);
switch(action) {
case (MotionEvent.ACTION_MOVE) :
Log.d(DEBUG_TAG,"Action was MOVE");
return true;
case (MotionEvent.ACTION_UP) :
Log.d(DEBUG_TAG,"Action was UP");
return true;
case (MotionEvent.ACTION_CANCEL) :
Log.d(DEBUG_TAG,"Action was CANCEL");
return true;
case (MotionEvent.ACTION_OUTSIDE) :
Log.d(DEBUG_TAG,"Movement occurred outside bounds " +
"of current screen element");
return true;
default :
return super.onTouchEvent(event);
}
}