在片段中膨胀多个布局会导致主drawyerlayout活动变慢。需要帮助

时间:2014-10-12 09:42:14

标签: android fragment drawerlayout

我有一个主要的Activity DrawerActivity包含xml

<android.support.v4.widget.DrawerLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <!-- The main content view -->
    <FrameLayout
        android:id="@+id/frame_container"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <!-- The navigation drawer -->
    <ListView android:id="@+id/left_drawer"
        android:layout_width="240dp"
        android:layout_height="match_parent"
        android:layout_gravity="right"
        android:choiceMode="singleChoice"
        android:divider="#666"
        android:dividerHeight="1dp"
        android:background="#333"
        android:paddingLeft="15sp"
        android:paddingRight="15sp"
        />

</android.support.v4.widget.DrawerLayout>

从我的DrawerActivity加载的片段类。

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) {

    rootView = inflater
            .inflate(R.layout.welcome_activity, container, false);

    initTabber();

    return rootView;
}
private void initTabber() {


        tabbar = (LinearLayout)rootView.findViewById(R.id.tabbar);
        tabLayout = LayoutInflater.from(activity.getApplicationContext()).inflate(
                R.layout.tabbar_layout, null);
        tabbar.addView(tabLayout);
        tabbarManager = new TabbarManager(context, tabLayout, activity);
        tabbarManager.initTabbar(false, false, false, false);
        ViewGroup tabGroup = (ViewGroup)rootView.findViewById(R.id.tabberContainer);
        FontsHandler.ApplyFontToGroup(tabGroup, AppConstants.EXT_MEDIUM);
}

当我在initTabber方法中膨胀tabber布局时,我的DrawerActivity变慢了。我的意思是DrawerLayout菜单没有顺利打开。需要帮助

0 个答案:

没有答案