我試圖讓這就是我創建了一個的LinearLayout內的片段的保持:安卓:動態創建的佈局中查找片段
編輯:這是一個擴展ArrayAdapter<G>
LinearLayout newView = new LinearLayout(getContext());
String inflater = Context.LAYOUT_INFLATER_SERVICE;
LayoutInflater li;
li = (LayoutInflater) getContext().getSystemService(inflater);
li.inflate(resource, newView, true);
在佈局片段稱爲TableRowView:
編輯:我糾正了XML語法
<fragment android:name ="mypackage.TableRowView"
android:id="@+id/row"
android:layout_width="match_parent"
android:layout_height="match_parent" />
我該如何獲得newView
的片段?
由於提前, --David
「在佈局內是一個名爲TableRowView的片段」 - 這是「View」或「ViewGroup」的語法。佈局中的碎片通過''元素。 –
CommonsWare
2013-02-15 17:14:22
好的,我會得到修正的,謝謝。我認爲這個問題仍然有效。 – CodeSlinger512 2013-02-15 18:03:05