当前位置: 首页>>代码示例>>Java>>正文


Java AppBarLayout.getChildCount方法代码示例

本文整理汇总了Java中android.support.design.widget.AppBarLayout.getChildCount方法的典型用法代码示例。如果您正苦于以下问题:Java AppBarLayout.getChildCount方法的具体用法?Java AppBarLayout.getChildCount怎么用?Java AppBarLayout.getChildCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.support.design.widget.AppBarLayout的用法示例。


在下文中一共展示了AppBarLayout.getChildCount方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreateView

import android.support.design.widget.AppBarLayout; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.content_notifications, container, false);

    AppBarLayout appBarLayout = getActivity().findViewById(R.id.appbar);

    if (appBarLayout.getChildCount() == 1) {
        mSectionsPagerAdapter = new SectionsPagerAdapter(getChildFragmentManager());

        mViewPager = rootView.findViewById(R.id.tab_container);
        mViewPager.setAdapter(mSectionsPagerAdapter);

        mTabLayout = new TabLayout(getActivity());
        mTabLayout.setTabTextColors(
                getResources().getColor(R.color.disabledGrey),
                getResources().getColor(R.color.white)
        );
        mTabLayout.setTabGravity(TabLayout.GRAVITY_FILL);
        mTabLayout.setupWithViewPager(mViewPager);

        appBarLayout.addView(mTabLayout);
    }

    return rootView;
}
 
开发者ID:dhbw-timetable,项目名称:dhbw-timetable-android,代码行数:26,代码来源:NotificationsFragment.java

示例2: onCreateView

import android.support.design.widget.AppBarLayout; //导入方法依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    AppBarLayout appBarLayout = getActivity().findViewById(R.id.appbar);

    if (appBarLayout.getChildCount() != 1) {
        appBarLayout.removeViewAt(1);
    }

    final View view = inflater.inflate(R.layout.content_today, container, false);
    recyclerView = view.findViewById(R.id.recyclingAgenda);

    aAdapter = new AgendaAppointmentAdapter(agendaAppointmentSet);
    RecyclerView.LayoutManager aLayoutManager = new LinearLayoutManager(view.getContext()) {
        @Override
        public boolean canScrollVertically() {
            return false;
        }
    };
    recyclerView.setLayoutManager(aLayoutManager);
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    recyclerView.setAdapter(aAdapter);
    return view;
}
 
开发者ID:dhbw-timetable,项目名称:dhbw-timetable-android,代码行数:25,代码来源:TodayFragment.java

示例3: ScrollFlag

import android.support.design.widget.AppBarLayout; //导入方法依赖的package包/类
public ScrollFlag(AppBarLayout layout) {
  if (layout != null) {
    int i = 0;
    for (int z = layout.getChildCount(); i < z; ++i) {
      View child = layout.getChildAt(i);
      ViewGroup.LayoutParams layoutParams = child.getLayoutParams();
      if (layoutParams instanceof AppBarLayout.LayoutParams) {
        AppBarLayout.LayoutParams childLp = (AppBarLayout.LayoutParams) layoutParams;
        int flags = childLp.getScrollFlags();
        if ((flags & AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL) != 0) {
          vView = child;
          mFlags = flags;
          break;
        }
      }
    }
  }
}
 
开发者ID:PacktPublishing,项目名称:Expert-Android-Programming,代码行数:19,代码来源:ScrollFlag.java

示例4: onCreateView

import android.support.design.widget.AppBarLayout; //导入方法依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    final Activity activity = getActivity();
    AppBarLayout appBarLayout = activity.findViewById(R.id.appbar);

    // Handle the tabs from navigation fragment
    if (appBarLayout.getChildCount() != 1) appBarLayout.removeViewAt(1);

    final View rootView = inflater.inflate(R.layout.content_week, container, false);

    // Reset to today
    weekToDisplay = new TimelessDate();
    int iDay = weekToDisplay.get(Calendar.DAY_OF_WEEK);
    if (iDay == Calendar.SATURDAY || iDay == Calendar.SUNDAY) {
        DateUtilities.Backport.NextWeek(weekToDisplay);
    }
    DateUtilities.Backport.Normalize(weekToDisplay);
    // activity.setTitle();
    TextView actTitle = activity.findViewById(R.id.toolbar_title);
    actTitle.setText(new SimpleDateFormat("MMM yyyy", Locale.GERMANY).format(weekToDisplay.getTime()));
    actTitle.setOnClickListener(v -> pickWeek(rootView, activity));
    TimetableManager.getInstance().loadOfflineGlobals(activity.getApplication(), () -> {
        Log.i("TTM", "Successfully loaded offline globals for week fragment.");
        applyGlobalContent(true, false, rootView, activity);
    });

    return rootView;
}
 
开发者ID:dhbw-timetable,项目名称:dhbw-timetable-android,代码行数:30,代码来源:WeekFragment.java


注:本文中的android.support.design.widget.AppBarLayout.getChildCount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。