Android仪表板模式作为片段

问题描述 投票:1回答:1

是否可以将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;
        }

}
android android-layout android-fragments dashboard
1个回答
0
投票
嘿我也正在为此工作,如果您喜欢它,可以帮我吗!谢谢
© www.soinside.com 2019 - 2024. All rights reserved.