Surface在Android应用程序上无效

时间:2014-10-29 09:46:07

标签: android view titanium appcelerator

Hello appcelerator专家,

我目前正在使用3个窗口(合金中)编写一个简单的应用程序。按下按钮后,窗口会相互显示,因此窗口1会显示一个按钮 - >转到窗口2 - >按下按钮 - >窗口3.使用后退按钮可以返回上一个窗口。

问题是应用程序有时会在窗口之间切换时崩溃并重新启动并产生错误" ViewRootImpl#2 Surface无效",我不知道如何解决。任何人之前已经看过这个问题或猜测可能是什么问题?也许eventListeners的东西经常被删除?

应用类型:移动 Titanium SDK:3.4.0.GA 平台&版本:Android 4.1 设备:物理android设备 主机操作系统:Mac OSX Yosemite Titanium studio:3.4.0.201409261227 build:jenkins-titanium-rcp-master-197

查看(index.xml):

<Alloy>


<Window id="intro_android" class="container">
    <View id="vdescription">
        <Label id="description1">Do you like discovering new restaurants, eating nice food AND saving money?</Label>
        <Label id="description2">The Food Fairy will help you!</Label>
        <Label id="description3">You will receive notifications like this:</Label>
        <ImageView id="screenshot" image="/images/screenshot.png"></ImageView>
    </View>
    <View class="vbutton">
        <Button id="getstarted" ></Button>  
    </View>
</Window>   

<Window id="usage_android" class="container">
    <View id="vsaved">
        <Label id="text_saved">You currently saved:</Label>
        <Label id="amount_saved">00.00 €</Label>
    </View>
    <View id="vranking">
        <TableView id="table">
            <TableViewSection>
                <TableViewRow class="row1"><Label class="number_ranking">1.</Label><Label class="name_ranking">John</Label><Label class="amount_ranking">637.02 €</Label></TableViewRow>
                <TableViewRow class="row2"><Label class="dots_ranking">...</Label></TableViewRow>
                <TableViewRow class="row3"><Label class="number_ranking">524.</Label><Label class="name_ranking">Mary</Label><Label class="amount_ranking">00.81 €</Label></TableViewRow>
                <TableViewRow class="userrow_ranking"><Label id="usernumber_ranking">525.</Label><Label id="username_ranking">YOU</Label><Label id="useramount_ranking">00.00 €</Label></TableViewRow>
                <TableViewRow class="row4"><Label class="number_ranking">526.</Label><Label class="name_ranking">Sarah</Label><Label class="amount_ranking">00.00 €</Label></TableViewRow>
                <TableViewRow class="row5"><Label class="dots_ranking">...</Label></TableViewRow>
            </TableViewSection>
        </TableView>
    </View>
    <View class="vbutton">
        <Button id="gethelp" ></Button> 
    </View>
</Window>

<Window id="help" class="container">
    <ScrollView id="vhelp">
        <Label id="help_text1">Heres more information:</Label>
        <Label class="help_text2">The Food Fairy finds the best food deals close to you! To help you find a place close-by to grab a bite on a budget, the fairy will send you a notification when you approach a restaurant offering a special deal.</Label>
        <Label class="help_text2">Because shes magic (duh), she doest need your app to be open and doesnt use GPS; she will know where you are, where the deals are, and will let you know when your paths cross.</Label>
    </ScrollView>
</Window>

</Alloy>

Controller(index.js):

function start_android(e) {
$.usage_android.open();
}

function start_ios(e) {
$.usage_ios.open();
}

function start_help(e) {
$.help.open();
}

感谢您的帮助!

1 个答案:

答案 0 :(得分:1)

对于有类似问题的人,我已经通过在他们的观点之外移动按钮来解决它:

<View class="vbutton">
    <Button id="getstarted" ></Button>  
</View>

分为:

    <Button id="getstarted" ></Button>