class WebviewMode 就是官方里的例子
//页面代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Hello MUI</title>
<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<!--标准mui.css-->
<link rel="stylesheet" href="css/mui.min.css">
<!--App自定义的css-->
<link rel="stylesheet" type="text/css" href="css/app.css"/>
</head>
<body>
<header class="mui-bar mui-bar-nav">
<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
<h1 class="mui-title">滑动触发列表项菜单</h1>
</header>
<div class="mui-content">
<h5 class="mui-content-padded" style="margin: 35px 10px 15px 10px;">拖拽(滑动)显示功能按钮,点击按钮触发事件</h5>
<ul id="OA_task_1" class="mui-table-view">
<li class="mui-table-view-cell">
<div class="mui-slider-right mui-disabled">
<a class="mui-btn mui-btn-red">删除</a>
</div>
<div class="mui-slider-handle">
左滑显示删除按钮
</div>
</li>
<li class="mui-table-view-cell">
<div class="mui-slider-left mui-disabled">
<a class="mui-btn mui-btn-red">删除</a>
</div>
<div class="mui-slider-handle">
右滑显示删除按钮
</div>
</li>
<li class="mui-table-view-cell">
<div class="mui-slider-left mui-disabled">
<a class="mui-btn mui-btn-red">删除</a>
</div>
<div class="mui-slider-right mui-disabled">
<a class="mui-btn mui-btn-red">删除</a>
</div>
<div class="mui-slider-handle">
左右滑动均可显示删除按钮
</div>
</li>
</ul>
<h5 class="mui-content-padded" style="margin: 15px 10px;">拖拽(滑动)显示操作图标,释放后还原,自动触发事件</h5>
<ul id="OA_task_2" class="mui-table-view">
<li class="mui-table-view-cell">
<div class="mui-slider-right mui-disabled">
<a class="mui-btn mui-btn-red">删除</a>
</div>
<div class="mui-slider-handle mui-table">
<div class="mui-table-cell">
左滑自动触发删除
</div>
</div>
</li>
<li class="mui-table-view-cell">
<div class="mui-slider-left mui-disabled">
<a class="mui-btn mui-btn-red">删除</a>
</div>
<div class="mui-slider-handle">
右滑自动触发删除
</div>
</li>
<li class="mui-table-view-cell">
<div class="mui-slider-left mui-disabled">
<a class="mui-btn mui-btn-red">删除</a>
</div>
<div class="mui-slider-right mui-disabled">
<a class="mui-btn mui-btn-red">删除</a>
</div>
<div class="mui-slider-handle">
左右滑动均可自动触发删除
</div>
</li>
</ul>
<h5 class="mui-content-padded" style="margin: 15px 10px;">拖拽(滑动)显示多功能菜单</h5>
<ul id="OA_task_2" class="mui-table-view">
<li class="mui-table-view-cell">
<div class="mui-slider-right mui-disabled">
<a class="mui-btn mui-btn-grey mui-icon mui-icon-person"></a>
<a class="mui-btn mui-btn-yellow mui-icon mui-icon-phone"></a>
<a class="mui-btn mui-btn-red mui-icon mui-icon-email"></a>
</div>
<div class="mui-slider-handle mui-table">
<div class="mui-table-cell">
左滑显示多功能菜单
</div>
</div>
</li>
<li class="mui-table-view-cell">
<div class="mui-slider-left mui-disabled">
<a class="mui-btn mui-btn-red mui-icon mui-icon-email"></a>
<a class="mui-btn mui-btn-yellow mui-icon mui-icon-phone"></a>
<a class="mui-btn mui-btn-grey mui-icon mui-icon-person"></a>
</div>
<div class="mui-slider-handle">
右滑显示多功能菜单
</div>
</li>
<li class="mui-table-view-cell">
<div class="mui-slider-left mui-disabled">
<a class="mui-btn mui-btn-red mui-icon mui-icon-email"></a>
<a class="mui-btn mui-btn-yellow mui-icon mui-icon-phone"></a>
<a class="mui-btn mui-btn-grey mui-icon mui-icon-person"></a>
</div>
<div class="mui-slider-right mui-disabled">
<a class="mui-btn mui-btn-grey mui-icon mui-icon-person"></a>
<a class="mui-btn mui-btn-yellow mui-icon mui-icon-phone"></a>
<a class="mui-btn mui-btn-red mui-icon mui-icon-email"></a>
</div>
<div class="mui-slider-handle">
左右滑动均可显示多功能菜单
</div>
</li>
</ul>
</div>
<script src="js/mui.min.js"></script>
<script>
mui.init();
(function($) {
//$.swipeoutOpen(el,direction)//打开指定列的滑动菜单,el:指定列的dom对象,direction:取值left|right,指定打开的是左侧或右侧滑动菜单
//$.swipeoutClose(el);//关闭指定列的滑动菜单,el:指定列的dom对象
// setTimeout(function() {
// $.swipeoutOpen(document.getElementById("OA_task_1").querySelector('li:last-child'), 'left');
// setTimeout(function() {
// $.swipeoutClose(document.getElementById("OA_task_1").querySelector('li:last-child'));
// }, 1000);
// }, 1000);
//第一个demo,拖拽后显示操作图标,点击操作图标删除元素;
$('#OA_task_1').on('tap', '.mui-btn', function(event) {
var elem = this;
mui.confirm('确认删除该条记录?', 'Hello MUI', btnArray, function(e) {
if (e.index == 0) {
var li = elem.parentNode.parentNode;
li.parentNode.removeChild(li);
}
});
});
var btnArray = ['确认', '取消'];
//第二个demo,向左拖拽后显示操作图标,释放后自动触发的业务逻辑
$('#OA_task_2').on('slideleft', '.mui-table-view-cell', function(event) {
var elem = this;
plus.nativeUI.confirm( "确认删除该条记录?", function(e){
console.log( (e.index==0)?"确认":"取消" );
if (e.index == 0) {
elem.parentNode.removeChild(elem);
}
}, "nativeUI", ["确认","取消"] );
});
//第二个demo,向右拖拽后显示操作图标,释放后自动触发的业务逻辑
$('#OA_task_2').on('slideright', '.mui-table-view-cell', function(event) {
var elem = this;
mui.confirm('确认删除该条记录?', 'Hello MUI', btnArray, function(e) {
if (e.index == 0) {
elem.parentNode.removeChild(elem);
}
});
});
})(mui);
</script>
</body>
</html>
properties.xml 打开如下:
<feature
name="Console"
value="io.dcloud.feature.pdr.LoggerFeatureImpl" >
</feature>
<feature
name="Cache"
value="io.dcloud.feature.pdr.CoreCacheFeatureImpl" >
</feature>
<feature
name="UI"
value="io.dcloud.feature.ui.UIFeatureImpl" >
<module
name="Navigator"
value="io.dcloud.feature.ui.NavView" />
</feature>
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.textsdk"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="15"
android:targetSdkVersion="21" />
<!-- pdr.jar -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!-- Invocation - JSB begin -->
<!-- 调用系统API,通过Native.js调用系统API需要的权限添加到这里 -->
<!-- 安装快捷方式 -->
<!-- 卸载快捷方式 -->
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
<uses-permission android:name="com.android.launcher.permission.UNINSTALL_SHORTCUT" />
<!-- Invocation - JSB end -->
<!-- 访问设备信息 -->
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.CALL_PHONE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.HBuilder.Integrate.webview.SDK_WebView"
android:configChanges="orientation|keyboardHidden|screenSize"
android:screenOrientation="sensor" >
</activity>
</application>
</manifest>
页面打开的时候没有问题,设备翻转后屏幕也翻转这时就是白屏了。。 不知是否少打开了某个功能?
还有class RInformation里的内容我都屏蔽掉了如下:
package io.dcloud;
import com.example.textsdk.R;
public class RInformation {
/*//5+Runtime - begin
public static int DRAWABLE_SPLASH = R.drawable.splash;
public static int DRAWABLE_ICON = R.drawable.icon;
public static int LAYOUT_SNOW_WHITE_PROGRESS = R.layout.snow_white_progress;
public static int LAYOUT_SNOW_BLACK_PROGRESS = R.layout.snow_black_progress;
public static int ID_PROGRESSBAR = R.id.progressBar;
//5+Runtime - end
//Action Sheet begin
public static int[] ACTS_STYLE_ACTIONSHEET = R.styleable.ActionSheet;
public static int ACTS_STYLE_actionSheetBackground = R.styleable.ActionSheet_actionSheetBackground;
public static int ACTS_STYLE_cancelButtonBackground = R.styleable.ActionSheet_cancelButtonBackground;
public static int ACTS_STYLE_otherButtonTopBackground = R.styleable.ActionSheet_otherButtonTopBackground;
public static int ACTS_STYLE_otherButtonMiddleBackground = R.styleable.ActionSheet_otherButtonMiddleBackground;
public static int ACTS_STYLE_otherButtonBottomBackground = R.styleable.ActionSheet_otherButtonBottomBackground;
public static int ACTS_STYLE_ActionSheet_cancelButtonTextColor = R.styleable.ActionSheet_otherButtonSingleBackground;
public static int ACTS_STYLE_cancelButtonTextColor = R.styleable.ActionSheet_cancelButtonTextColor;
public static int ACTS_STYLE_otherButtonTextColor = R.styleable.ActionSheet_otherButtonTextColor;
public static int ACTS_STYLE_actionSheetPadding = R.styleable.ActionSheet_actionSheetPadding;
public static int ACTS_STYLE_otherButtonSpacing = R.styleable.ActionSheet_otherButtonSpacing;
public static int ACTS_STYLE_cancelButtonMarginTop = R.styleable.ActionSheet_cancelButtonMarginTop;
public static int ACTS_STYLE_actionSheetTextSize = R.styleable.ActionSheet_actionSheetTextSize;
public static int ACTS_STYLE_otherButtonSingleBackground = R.styleable.ActionSheet_otherButtonSingleBackground;
public static int ACTS_ATTR_SctionSheetSytle = R.attr.actionSheetStyle;
public static int ACTS_STYLE_ActionSheetStyleIOS7 = R.style.ActionSheetStyleIOS7;
public static int ACTS_STYLE_titleButtonTextColor = R.styleable.ActionSheet_titleButtonTextColor;
public static int ACTS_STYLE_destructiveButtonTextColor = R.styleable.ActionSheet_destructiveButtonTextColor;
public static int ACTS_STYLE_otherButtonTitleBackground = R.styleable.ActionSheet_otherButtonTitleBackground;
// ActionSheet end
//Image_Picker begin
public static int LAYOUT_IMAGE_PICK_GALLERY = R.layout.image_pick_gallery;
public static int ID_IMAGE_PICK_GRID_GALLERY = R.id.gridGallery;
public static int ID_IMAGE_PICK_NO_MEDIA = R.id.imgNoMedia;
public static int ID_IMAGE_PICK_BTN_OK = R.id.titleBtn;
public static int ID_IMAGE_PICK_TITLE = R.id.tvTitleText;
public static int LAYOUT_IMAGE_PICK_GALLERY_ITEM = R.layout.image_pick_gallery_item;
public static int ID_IMAGE_PICK_IMG_QUEUE = R.id.imgQueue;
public static int ID_IMAGE_PICK_MASK = R.id.imgQueueMask;
public static int DRAWABLE_IMAGE_PICK_NO_MEDIA = R.drawable.image_pick_no_media;
//Image_Picker end
//StreamApp begin
public static int STREAMAPP_LIST_ITEM_APPICON = R.id.StreamApp_List_appIcon;
public static int STREAMAPP_LIST_ITEM_APPSUMMARY = R.id.StreamApp_List_appSummary;
public static int STREAMAPP_LIST_ITEM_APPTITLE = R.id.StreamApp_List_appTitle;
public static int STREAMAPP_LIST_ITEM_STOREUPICON = R.id.StreamApp_List_StoreUpIcon;
public static int STREAMAPP_LIST_ITEM_LEFTPART = R.id.StreamApp_List_Leftpart;
public static int STREAMAPP_LIST_ITEM_STOREUP = R.id.StreamApp_List_StoreUp;
// public static int STREAMAPP_DRAWABLE_STOREUP = R.drawable.streamapp_icon_storeup;
// public static int STREAMAPP_DRAWABLE_UNSTOREUP = R.drawable.streamapp_icon_unstoreup;
// public static int STREAMAPP_DRAWABLE_APPDEFULTICON = R.drawable.streamapp_icon_appdefault;
public static int STREAMAPP_LAYOUT_LISTITEM = R.layout.streamapp_list_item;
public static int STREAMAPP_LIST_ITEM_DIVIDER = R.id.Streamapp_List_Divider;
//StreamApp end
//Dialog begin
public static int DRAWABLE_DCLOUD_DIALOG_SHAPE = R.drawable.dcloud_dialog_shape;
public static int LAYOUT_DIALOG_LAYOUT_DCLOUD_DIALOG = R.layout.dcloud_dialog;
public static int ID_DCLOUD_DIALOG_ROOTVIEW = R.id.dcloud_dialog_rootview;
public static int ID_DCLOUD_DIALOG_TITLE = R.id.dcloud_dialog_title;
public static int ID_DCLOUD_DIALOG_ICON = R.id.dcloud_dialog_icon;
public static int ID_DCLOUD_DIALOG_MSG = R.id.dcloud_dialog_msg;
public static int ID_DCLOUD_DIALOG_BTN1 = R.id.dcloud_dialog_btn1;
public static int ID_DCLOUD_DIALOG_BTN2 = R.id.dcloud_dialog_btn2;
public static int STYLE_DIALOG_DCLOUD_DEFALUT_DIALOG = R.style.dcloud_defalut_dialog;
public static int STYLE_DIALOG_STYLE_DCLOUD_ANIM_DIALOG_WINDOW_IN_OUT = R.style.dcloud_anim_dialog_window_in_out;
public static int ANIM_DIALOG_ANIM_DCLOUD_SLIDE_IN_FROM_TOP = R.anim.dcloud_slide_in_from_top;
public static int ANIM_DIALOG_ANIM_DCLOUD_SLIDE_OUT_TO_TOP = R.anim.dcloud_slide_out_to_top;*/
//Dialog end
}
1 个回复
vilens
android:targetSdkVersion=21 去掉