我是PanesLibrary的新用户,但我不知道如何在应用程序启动时在后台显示个人布局。该代码类似于github上的示例,没有自动生成的片段和示例片段:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setPaneSizer(new ExamplePaneSizer()); //inner class like on the github example
// Lets setup a menu and a first pane!
if (savedInstanceState == null) {
Fragment menu = new CatFragment(); //show list of categories
setMenuFragment(menu);
}
}
这是ExampleActivity:的布局
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".SandboxActivity" >
<com.mapsaurus.paneslayout.PanesLayout
android:id="@+id/panes"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
>
<TextView
android:id="@+id/textView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Some Text"
android:textAppearance="?android:attr/textAppearanceLarge" />
</com.mapsaurus.paneslayout.PanesLayout>
问题是TextView没有显示。谢谢
我解决了。只需添加一个新的片段
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setPaneSizer(new ExamplePaneSizer());
// Lets setup a menu and a first pane!
if (savedInstanceState == null) {
Fragment menu = new CatFragment();
Fragment instr = new InstructionFragment();
setMenuFragment(menu);
addFragment(menu, instr);