首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Android >

照着书里的代码打了一遍,不过运作总是崩溃

2013-09-05 
照着书里的代码打了一遍,不过运行总是崩溃MainActivity.java的代码android:layout_heightwrap_contenta

照着书里的代码打了一遍,不过运行总是崩溃

MainActivity.java的代码


        android:layout_height="wrap_content"
        android:text="@string/kkk" />

 <Button android:id="@+id/ok"
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content"
        android:text="@string/trans"/>
</LinearLayout>



result.xml的布局
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >
    
<TextView 
    android:id="@+id/getdata"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"/>
    
</LinearLayout>


AndroidManifest.xml的部分配置
 <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/title_activity_main" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name=".ResultActivity"></activity>
    </application>



运行总提示:The application activity(process com.example.activity) has stopped unexpectedly.please try again.不清楚哪里出了问题,帮忙看下,谢谢谢谢

分享到:
[解决办法]
仔细看看LogCat下面的日志,定位出错的地方。

热点排行