Android仪表板模式为片段

时间:2012-10-07 18:53:49

标签: android android-layout android-fragments dashboard

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

}

0 个答案:

没有答案