列表视图按钮后崩溃的应用程序--- XML [英] Button after listview crashing the app--- XML

查看:115
本文介绍了列表视图按钮后崩溃的应用程序--- XML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道为什么,但我不能让我的按钮,列表视图后显示出来。它确实显示精细的日食图形布局,但是当我启动程序崩溃模拟器.​​.....这里是我的xml code,如果我将列表视图上面的按钮一切正常。有任何想法吗?点我在正确的方向,请...

 < RelativeLayout的的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
机器人:layout_width =FILL_PARENT
机器人:layout_height =WRAP_CONTENT>

<的TextView
    机器人:ID =@ + ID / tvTeam1Name
    机器人:layout_width =WRAP_CONTENT
    机器人:layout_height =WRAP_CONTENT
    机器人:文本=/>

<的TextView
    机器人:ID =@ + ID / tvTeam2Name
    机器人:layout_width =WRAP_CONTENT
    机器人:layout_height =WRAP_CONTENT
    机器人:文本=/>

<的TextView
    机器人:ID =@ + ID / tvVVTEST
    机器人:layout_width =WRAP_CONTENT
    机器人:layout_height =WRAP_CONTENT
    机器人:文本=tvVVTEST/>

<的TextView
    机器人:ID =@ + ID / tvTeam1Score
    机器人:layout_width =WRAP_CONTENT
    机器人:layout_height =WRAP_CONTENT
    机器人:文本=0/>

<的TextView
    机器人:ID =@ + ID / tvTeam2Score
    机器人:layout_width =WRAP_CONTENT
    机器人:layout_height =WRAP_CONTENT
    机器人:文本=0/>

<按钮
    机器人:ID =@ + ID / BTEST
    机器人:layout_width =WRAP_CONTENT
    机器人:layout_height =WRAP_CONTENT
    机器人:文本=测试/>

<的ListView
    机器人:ID =@ + ID / TLIST
    机器人:layout_width =FILL_PARENT
    机器人:layout_height =WRAP_CONTENT
    机器人:layout_above =@ + ID / bNewRound
    机器人:layout_below =@ + ID / BTEST/>

<按钮
    机器人:ID =@ + ID / bNewRound
    机器人:layout_width =WRAP_CONTENT
    机器人:layout_height =WRAP_CONTENT
    机器人:layout_alignParentBottom =真
    机器人:文本=新一轮/>
 

解决方案

 < LinearLayout中的android:layout_width =match_parent机器人:layout_height =match_parent>

    < RelativeLayout的机器人:layout_width =match_parent机器人:layout_height =WRAP_CONTENT>
        < TextView的Andr​​oid的:layout_width =match_parent机器人:layout_height =WRAP_CONTENT/>
        <的TextView />
        <的TextView />
    < / RelativeLayout的>

    < ListView的机器人:layout_width =match_parent机器人:layout_height =match_parent机器人:layout_weight =1/>

    <按钮机器人:layout_width =match_parent机器人:layout_height =WRAP_CONTENT/>
    <按钮机器人:layout_width =match_parent机器人:layout_height =WRAP_CONTENT/>

< / LinearLayout中>
 

I dont know why but i cant get my button to show up after the listview. It does show fine in eclipse-graphical layout but when i launch the emulator the program crashes... here is my xml code and if i move the button above the listview everything is OK. Any ideas? point me in the right direction please...

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >

<TextView
    android:id="@+id/tvTeam1Name"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text=" " />

<TextView
    android:id="@+id/tvTeam2Name"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text=" " />

<TextView
    android:id="@+id/tvVVTEST"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="tvVVTEST" />

<TextView
    android:id="@+id/tvTeam1Score"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="0" />

<TextView
    android:id="@+id/tvTeam2Score"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="0" />

<Button
    android:id="@+id/bTest"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Test" />

<ListView
    android:id="@+id/tlist"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_above="@+id/bNewRound"
    android:layout_below="@+id/bTest" />

<Button
    android:id="@+id/bNewRound"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:text="New Round" />

解决方案

<LinearLayout android:layout_width="match_parent" android:layout_height="match_parent">

    <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content">
        <TextView android:layout_width="match_parent" android:layout_height="wrap_content"/>
        <TextView />
        <TextView />
    </RelativeLayout>       

    <ListView android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" />

    <Button  android:layout_width="match_parent" android:layout_height="wrap_content"/>
    <Button  android:layout_width="match_parent" android:layout_height="wrap_content"/>

</LinearLayout>

这篇关于列表视图按钮后崩溃的应用程序--- XML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆