是否可以将Google I / O的android仪表板模式用作片段,以便在平板电脑的横向模式下,仪表板显示在左侧,而当前类别的内容显示在右侧?
我尝试了类似于以下代码的操作,但是不起作用。
main.xml:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- Include dashboard -->
<include layout="@layout/fragment_dashboard"/>
<!-- Include details -->
<fragment
android:id="@+id/fragment_details"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.example.fragments.Details" />
</LinearLayout>
Details.java:
public class Details extends Fragment
{
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState)
{
View view = inflater.inflate(R.layout.details, container, false);
return view;
}
}