0

我注意到,当我使用钛合金在 Android 设备中部署应用程序时,它工作缓慢,似乎 android 应用程序在触摸和单击后需要时间重定向到下一页。它在我单击任何后 3 或 4 秒内进入下一页UI 元素(按钮、视图、标签、图像)

另一方面,它与 IOS 设备(iphone 和 ipad)完美配合

我不知道android到底应该有什么问题。我还在android中重置了我的工厂数据并再次测试了应用程序,但问题仍然存在

这是 android 触摸/点击问题吗?

请反馈我的问题,并给我你的建议如何解决它。提前致谢

4

3 回答 3

1

您的问题不是设备,而可能是您的登录 API。我建议您插入一个指示器来缩短等待时间,如下所示:

----index.xml----
<Alloy>
    <Window class="login_container" height="auto" horizontalWrap="true">
    <ActivityIndicator id="activityIndicator" message="Wait please..."/>

----index.js----

function login(e) {  
var uname = $.username.value.split(' ').join('');
var pwd = $.password.value.split(' ').join('');

if(uname == ""){
    alert("Enter username.");
    return false;
}
if(pwd == ""){
    alert("Enter password.");
    return false;
}

$.activityIndicator.show();

在更改控制器之前添加

$.activityIndicator.hide();
于 2016-01-21T17:14:34.067 回答
0

通过使用活动指示器等待一段时间,我理解了您所说的和解释的内容,但这只会解决登录活动的问题。但是无论我在哪里使用 UI 实用程序,(Button Onclick、Label onclick、Image Onclick、View Onclick)重定向到下一页至少需要 4 到 5 秒的时间。我也在两个页面的切换之间使用了加载器但是仍然需要时间(4到5秒)来影响点击事件并重定向到下一页

于 2016-01-22T04:04:35.440 回答
0

下面是我的控制器,查看钛中一页的文件

----index.js---

function login(e) {  
    var uname = $.username.value.split(' ').join('');
    var pwd = $.password.value.split(' ').join('');

    if(uname == ""){
        alert("Enter username.");
        return false;
    }
    if(pwd == ""){
        alert("Enter password.");
        return false;
    }




    //if(results.length == 0){
    if (Titanium.Network.networkType === Titanium.Network.NETWORK_NONE) {
           alert('There is no internet connection.');
           return false;
        } 

        var loginReq = Titanium.Network.createHTTPClient();
        var params = {
            func : "'"+Ti.Utils.base64encode('check_login')+"'",
            username : uname,
            password : pwd
        };
        loginReq.onload = function()
        {
            var json = this.responseText;
            var response = JSON.parse(json);
            if(response == 'account_inactive'){
                alert('Your account has been inactive. Please contact to your company');
                //$.index.close();
                var index = Alloy.createController('index').getView();
                index.open();
                return false;   

            }


           if(response == 'invalid'){
                alert('Invalid username or password');
                //$.index.close();
                var index = Alloy.createController('index').getView();
                index.open();
                return false;       
            }

            else
            {
                results = {
                    iuser_id: response.iuser_id,
                    signup_ids: response.signup_ids,
                    staff_id : response.staff_id,           
                    vusername: response.vusername,
                    vfirst_name: response.vfirst_name,
                    vlast_name: response.vlast_name,
                    vemail : response.vemail,
                    vpwd : response.vpwd
                    };  
                Ti.App.Properties.setObject("user_session",results);
                results = null;
                var flag = '';

                if (!Ti.App.Properties.hasProperty('installed')) 
                {
                    Ti.App.Properties.setBool('app:isLoggedIn', true);
                    Ti.App.Properties.hasProperty('installed');
                    Ti.App.Properties.setBool('installed', true);
                    var th_sign = Alloy.createController('login').getView();
                    th_sign.open();
                }
                else
                {

                    var th_sign = Alloy.createController('account').getView();
                    th_sign.open();
                }
                }       

            json = null;
            response = null;
        };
        if(os_name == 'android'){
        loginReq.open("GET", WEB_ROOT+"get_init.php");
        }
        else{
        loginReq.open("POST", WEB_ROOT+"get_init.php"); 
        }
        loginReq.send(params);

}
$.index.open();

----index.xml-------

<Alloy>
    <Window class="login_container" height="auto" horizontalWrap="true">
        <ScrollView id="scrollView_index" showVerticalScrollIndicator="true" height="100%" width="100%" scrollType="vertical">
            <View id="index_view">

                <ImageView class="logo" image="/images/login/logo.png" top='25' />

                <TextField id="username" class="usernameTxt" value="" border="0" top="230" />
                <TextField id="password" class="passwordTxt" value="" border="0" top="275" />
                <Button id="loginButton" class="login_bg" onClick="login">Login</Button>


            </View>     

        </ScrollView>       
    </Window>
</Alloy>
于 2016-01-21T11:42:34.583 回答