相關XML:設置LinearLayout的可見性時出現問題
<LinearLayout
android:id="@+id/linear_layout_video_feed_list_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:layout_weight="2">
<ListView
android:id="@+id/list_video_feed"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
</ListView>
</LinearLayout>
相關代碼:
linearLayoutVideoFeedListView = (LinearLayout) findViewById(R.id.linear_layout_video_feed_list_view);
lv = (ListView) findViewById(R.id.list_video_feed)
lv.setVisibility(GONE)
有效,但linearLayoutVideoFeedListView.setVisibility(GONE)
會導致nullpointer異常。誰知道爲什麼?
你叫'linearLayoutVideoFeedListView.setVisibility(消失)''後,LV =(ListView控件)findViewById(R.id.list_video_feed)'? – 2011-06-09 14:43:01
如果其最頂層的父項是否可以隱藏根視圖? – Spidy 2011-06-09 14:53:49
@Gabriel是的,我是 – yellavon 2011-06-09 14:58:07