我在SRC> myproject.test> HomeViewAndroid的自定義視圖強制力接近
自定義視圖在我的主要佈局的xml我有以下幾點:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/home_root"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<myproject.test.HomeView
android:id="@+id/home_view"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
</myproject.test.HomeView>
</LinearLayout>
在HomeActivity我有一個電話像onCreate方法一樣。
setContentView(R.layout.main);
HomeView mHomeView = (HomeView) this.findViewById(R.id.home_view);
當setContentView方法被調用時,app force關閉。看來,我的主要XML不正確。
任何想法?
什麼是logcat的輸出? – EboMike 2010-10-21 21:38:13
@EBoMiko我在哪裏可以看到? – skyfoot 2010-10-21 22:08:04
從控制檯調用'adb logcat V'。每當你接近一支部隊時,這應該是你的第一本能。 – EboMike 2010-10-21 22:10:48