2
我想在運行時從Misc widgets for Android platform創建一個面板。如何爲AttributeSet正確編寫XML?
XmlPullParser parser = getResources().getXml(R.xml.panel_attribute);
AttributeSet attributes = Xml.asAttributeSet(parser);
Panel panel = (Panel) new Panel(getActivity(),attributes);
什麼應該是panel_attribute.xml?
面板看起來應該是這樣
<org.miscwidgets.widget.Panel
xmlns:panel="http://schemas.android.com/apk/res/org.miscwidgets"
android:id="@+id/topPanel"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingBottom="4dip"
panel:animationDuration="1000"
panel:closedHandle="@drawable/sliding_drawer_handle_minimized"
panel:content="@+id/searchparams_layout"
panel:handle="@+id/handle"
panel:linearFlying="true"
panel:openedHandle="@drawable/sliding_drawer_handle_minimized"
panel:position="top" />