android提示:很抱歉!應用程式xxxx(進程:xxx.xxx.xxx)意外停止,請重試 強行關閉

來源:互聯網
上載者:User

 

照著別人的代碼寫,總是會出現意想不到的驚喜 

 

<?xml version="1.0" encoding="utf-8"?><br /><linearlayout<br />xmlns:android="http://schemas.android.com/apk/res/android"<br />android:orientation="vertical"<br />android:layout_width="fill_parent"<br />android:layout_height="fill_parent"><br /><textview<br />android:layout_height="wrap_content"<br />android:layout_width="wrap_content"<br />android:id="@+id/TextView01"<br />android:text="杜鵑" ></p><p></textview><br /></linearlayout><br /><!-- <?xml version="1.0" encoding="utf-8"?> --><br /><!-- <LinearLayout --><br /><!-- xmlns:android="http://schemas.android.com/apk/res/android" --><br /><!-- android:orientation="vertical" --><br /><!-- android:layout_width="fill_parent" --><br /><!-- android:layout_height="fill_parent"> --><br /><!-- <TextView --><br /><!-- android:layout_width="fill_parent" --><br /><!-- android:layout_height="wrap_content" --><br /><!-- android:text="@string/hello" /> --><br /><!-- </LinearLayout> --><br /> 

上面沒注釋掉的開始是照著網上的代碼寫的,

下面的時候eclipse自動產生的程式碼

本來上面的很多,怎麼改都編譯不成功,就一直改,最後就改的跟下面的快一樣了

當改的沒錯誤的時候,一運行,模擬器就顯示 應用程式意外停止。

 

最後終於改的一樣了 ,卻是linearlayout 和 textview 要寫成 LinearLayout 和 TextView

很是鬱悶啊

這個部落格:http://android.yaohuiji.com/archives/386

裡面貼的代碼用小寫, 到我這裡就不行了。

 

貌似我貼上來的代碼 引號也變成中文下的了?

 

-----------------------------------------------華麗分割線2011-03-25----18:19:21-------------------------------------

再次碰到引起意外停止的情況

//定義checkbox<br />final CheckBox cb1 = (CheckBox) findViewById(R.id.CheckBox01);<br />// 定義點擊監聽<br /> OnClickListener click = new OnClickListener()<br /> {<br /> @Override<br /> public void onClick(View v)<br /> {<br /> Toast.makeText(getApplicationContext(),<br /> "點擊" + ((ImageView) v).getId(), Toast.LENGTH_LONG).show();<br />// Toast.makeText(getApplicationContext(),<br />// "點擊" + ((Button) v).getId(), Toast.LENGTH_SHORT).show();<br /> }<br /> //點擊要求起點落點都在同一範圍(按鈕)內?<br /> };<br />// 綁定監聽<br /> cb1.setOnClickListener(click); 

這樣就會報錯,採用注釋的就可以正常運行,

Button, ImageView,ImageButton

CheckBox 用Button

ImageView/ImageButton用ImageView

否則出錯。

-----------------------------------------------------分割2011-03-26----11:21:55---------------------------------

加個繼承圖

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.