在本文中,我们将带你了解com.facebook.litho.widget.LinearLayoutInfo的实例源码在这篇文章中,我们将为您详细介绍com.facebook.litho.widget
在本文中,我们将带你了解com.facebook.litho.widget.LinearLayoutInfo的实例源码在这篇文章中,我们将为您详细介绍com.facebook.litho.widget.LinearLayoutInfo的实例源码的方方面面,并解答facebook源代码常见的疑惑,同时我们还将给您一些技巧,以帮助您实现更有效的android.support.design.widget.CoordinatorLayout.LayoutParams的实例源码、android.support.v7.widget.LinearLayoutCompat.LayoutParams的实例源码、android.support.v7.widget.LinearLayoutCompat的实例源码、android.support.v7.widget.LinearLayoutManager的实例源码。
本文目录一览:- com.facebook.litho.widget.LinearLayoutInfo的实例源码(facebook源代码)
- android.support.design.widget.CoordinatorLayout.LayoutParams的实例源码
- android.support.v7.widget.LinearLayoutCompat.LayoutParams的实例源码
- android.support.v7.widget.LinearLayoutCompat的实例源码
- android.support.v7.widget.LinearLayoutManager的实例源码
com.facebook.litho.widget.LinearLayoutInfo的实例源码(facebook源代码)
public static void initialize(Context context) { final ComponentContext c = new ComponentContext(context); final RecyclerBinder glideRecyclerBinder = new RecyclerBinder( c,4.0f,new LinearLayoutInfo(c,OrientationHelper.VERTICAL,false)); DataModel.populateBinderWithSampleDataForGlide(glideRecyclerBinder,c); demoModels = new LinkedHashMap<>(); demoModels.put( "Lithography - Picasso",LithographyRootComponent.create(c) .recyclerBinder(glideRecyclerBinder) .build()); demoModels.put("Playground",PlaygroundComponent.create(c).build()); }
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_repos); bindViews(this); componentContext = new ComponentContext(this); recyclerBinder = new RecyclerBinder( componentContext,new LinearLayoutInfo(this,false)); sRefresh.setonRefreshListener(() -> store.dispatch(HomeAction.REFRESH)); }
@Override public Component createComponent(ComponentContext c) { final RecyclerBinder imageRecyclerBinder = new RecyclerBinder.Builder().layoutInfo( new LinearLayoutInfo(c,OrientationHelper.HORIZONTAL,false)).build(c); for (String image : images) { ComponentRenderInfo.Builder imageComponentInfoBuilder = ComponentRenderInfo.create(); imageComponentInfoBuilder.component( GlideSingleImageComponent.create(c).image(image).aspectRatio(2).build()); imageRecyclerBinder.insertItemAt(imageRecyclerBinder.getItemCount(),imageComponentInfoBuilder.build()); } return FeedItemCard.create(c).artist(this).binder(imageRecyclerBinder).build(); }
@OnCreateLayout static ComponentLayout onCreateLayout(ComponentContext c) { final RecyclerBinder recyclerBinder = new RecyclerBinder.Builder().layoutInfo( new LinearLayoutInfo(c,false)).build(c); Demos.addAllToBinder(recyclerBinder,c); return Recycler.create(c) .binder(recyclerBinder) .flexShrink(0) .testKey(MAIN_SCREEN) .buildWithLayout(); }
public static void initialize(Context context) { final ComponentContext c = new ComponentContext(context); final RecyclerBinder glideRecyclerBinder = new RecyclerBinder.Builder().layoutInfo( new LinearLayoutInfo(c,false)).build(c); DataModel.populateBinderWithSampleDataForGlide(glideRecyclerBinder,c); demoModels = new LinkedHashMap<>(); demoModels.put("Lithography - Glide",LithographyRootComponent.create(c).recyclerBinder(glideRecyclerBinder).build()); demoModels.put("Playground",PlaygroundComponent.create(c).build()); }
@Override public Component createComponent(ComponentContext c) { final RecyclerBinder imageRecyclerBinder = new RecyclerBinder(c,false)); for (String image : images) { ComponentInfo.Builder imageComponentInfoBuilder = ComponentInfo.create(); imageComponentInfoBuilder.component( PicassoSingleImageComponent.create(c).image(image).fit(true).build()); imageRecyclerBinder.insertItemAt(imageRecyclerBinder.getItemCount(),imageComponentInfoBuilder.build()); } return FeedItemCard.create(c).artist(this).binder(imageRecyclerBinder).build(); }
@OnCreateLayout static ComponentLayout onCreateLayout(ComponentContext c) { final RecyclerBinder recyclerBinder = new RecyclerBinder( c,false)); Demos.addAllToBinder(recyclerBinder,c); return Recycler.create(c) .binder(recyclerBinder) .withLayout().flexShrink(0) .testKey(MAIN_SCREEN) .build(); }
private void renderContent(List<HomeSection> sections) { sRefresh.setRefreshing(false); ComponentInfo.Builder componentInfoBuilder; for (HomeSection section : sections) { componentInfoBuilder = ComponentInfo.create(); if (section instanceof SingleBannerSection) { componentInfoBuilder .component( SingleBannerComponent .create(componentContext) .payload((SingleBannerSection) section) .key(((SingleBannerSection) section).title()) .build() ); } else if (section instanceof TripleBannerSection) { componentInfoBuilder .component( TripleBannersComponent.create(componentContext) .payload((TripleBannerSection) section) .key(((TripleBannerSection) section).title()) .build() ); } else if (section instanceof ProductSlideSection) { final RecyclerBinder productSlideBinder = new RecyclerBinder(componentContext,false)); for (Product product : ((ProductSlideSection) section).products()) { componentInfoBuilder = ComponentInfo.create(); componentInfoBuilder .component( ProductComponent.create(componentContext) .product(product) .key(product.id()) .build() ); productSlideBinder.insertItemAt(productSlideBinder.getItemCount(),componentInfoBuilder.build()); } componentInfoBuilder = ComponentInfo.create(); componentInfoBuilder .component( ProductSlideComponent.create(componentContext) .title(((ProductSlideSection) section).title()) .recyclerBinder(productSlideBinder) .key(((ProductSlideSection) section).title()) .build() ); } recyclerBinder.insertItemAt(recyclerBinder.getItemCount(),componentInfoBuilder.build()); } ltView.setComponent( HomeListComponent .create(componentContext) .binder(recyclerBinder) .build() ); }
android.support.design.widget.CoordinatorLayout.LayoutParams的实例源码
protected void layoutChild(CoordinatorLayout parent,View child,int layoutDirection) { View header = findFirstDependency(parent.getDependencies(child)); if (header != null) { LayoutParams lp = (LayoutParams) child.getLayoutParams(); Rect available = this.mTempRect1; available.set(parent.getPaddingLeft() + lp.leftMargin,header.getBottom() + lp.topMargin,(parent.getWidth() - parent.getPaddingRight()) - lp.rightMargin,((parent.getHeight() + header.getBottom()) - parent.getPaddingBottom()) - lp.bottomMargin); Rect out = this.mTempRect2; GravityCompat.apply(resolveGravity(lp.gravity),child.getMeasuredWidth(),child.getMeasuredHeight(),available,out,layoutDirection); int overlap = getoverlapPixelsForOffset(header); child.layout(out.left,out.top - overlap,out.right,out.bottom - overlap); this.mVerticalLayoutGap = out.top - header.getBottom(); return; } super.layoutChild(parent,child,layoutDirection); this.mVerticalLayoutGap = 0; }
private boolean updateFabVisibility(CoordinatorLayout parent,AppBarLayout appBarLayout,FloatingActionButton child) { if (((LayoutParams) child.getLayoutParams()).getAnchorId() != appBarLayout.getId() || child.getUserSetVisibility() != 0) { return false; } if (this.mTmpRect == null) { this.mTmpRect = new Rect(); } Rect rect = this.mTmpRect; ViewGroupUtils.getDescendantRect(parent,appBarLayout,rect); if (rect.bottom <= appBarLayout.getMinimumHeightForVisibleOverlappingContent()) { child.hide(null,false); } else { child.show(null,false); } return true; }
private void offsetIfNeeded(CoordinatorLayout parent,FloatingActionButton fab) { Rect padding = fab.mShadowPadding; if (padding != null && padding.centerX() > 0 && padding.centerY() > 0) { LayoutParams lp = (LayoutParams) fab.getLayoutParams(); int offsetTB = 0; int offsetLR = 0; if (fab.getRight() >= parent.getWidth() - lp.rightMargin) { offsetLR = padding.right; } else if (fab.getLeft() <= lp.leftMargin) { offsetLR = -padding.left; } if (fab.getBottom() >= parent.getBottom() - lp.bottomMargin) { offsetTB = padding.bottom; } else if (fab.getTop() <= lp.topMargin) { offsetTB = -padding.top; } fab.offsetTopAndBottom(offsetTB); fab.offsetLeftAndRight(offsetLR); } }
@Override protected void subscribeActual(Observer<? super View> observer) { if (!checkMainThread(observer)) { return; } if (!(view.getLayoutParams() instanceof LayoutParams)) { throw new IllegalArgumentException("The view is not in a Coordinator Layout."); } LayoutParams params = (LayoutParams) view.getLayoutParams(); final SwipedismissBehavior behavior = (SwipedismissBehavior) params.getBehavior(); if (behavior == null) { throw new IllegalStateException("There's no behavior set on this view."); } Listener listener = new Listener(behavior,observer); observer.onSubscribe(listener); behavior.setListener(listener); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_swipe_behavior); final SwipedismissBehavior swipe = new SwipedismissBehavior(); swipe.setSwipeDirection(SwipedismissBehavior.SWIPE_DIRECTION_ANY); swipe.setListener(new SwipedismissBehavior.OndismissListener() { @Override public void ondismiss(View view) { Toast.makeText(SwipeBehaviorExampleActivity.this,"Card swiped !!",Toast.LENGTH_SHORT).show(); } @Override public void onDragStateChanged(int state) {} }); CardView cardView = (CardView) findViewById(R.id.swype_card); LayoutParams coordinatorParams = (LayoutParams) cardView.getLayoutParams(); coordinatorParams.setBehavior(swipe); }
@Override public boolean onDependentViewChanged(CoordinatorLayout parent,FloatingActionButton floatingActionButton,View dependency) { if (dependency instanceof AppBarLayout) { AppBarLayout appBarLayout = (AppBarLayout) dependency; LayoutParams lp = (LayoutParams) floatingActionButton.getLayoutParams(); int distancetoScroll = floatingActionButton.getHeight() + lp.bottomMargin; float ratio = ViewCompat.getY(appBarLayout) / (float) appBarLayout.getTotalScrollRange(); ViewCompat.setTranslationY(floatingActionButton,-distancetoScroll * ratio); return true; } return super.onDependentViewChanged(parent,floatingActionButton,dependency); }
@Override public boolean onDependentViewChanged(CoordinatorLayout parent,View dependency) { if (dependency instanceof AppBarLayout) { AppBarLayout appBarLayout = (AppBarLayout) dependency; LayoutParams lp = (LayoutParams) floatingActionButton.getLayoutParams(); int distancetoScroll = floatingActionButton.getHeight() + lp.bottomMargin; float ratio = ViewCompat.getY(appBarLayout) / (float) appBarLayout.getTotalScrollRange(); ViewCompat.setTranslationY(floatingActionButton,dependency); }
Base(CoordinatorLayout parent,View child) { super(parent.getContext()); // Draw at the same level of the child. parent.addView(this,parent.indexOfChild(child),new LayoutParams(MATCH_PARENT,MATCH_PARENT)); }
android.support.v7.widget.LinearLayoutCompat.LayoutParams的实例源码
private void performCollapse() { if (!isCollapsed()) { if (this.mTabSpinner == null) { this.mTabSpinner = createSpinner(); } removeView(this.mTabLayout); addView(this.mTabSpinner,new ViewGroup.LayoutParams(-2,-1)); if (this.mTabSpinner.getAdapter() == null) { this.mTabSpinner.setAdapter(new TabAdapter()); } if (this.mTabSelector != null) { removeCallbacks(this.mTabSelector); this.mTabSelector = null; } this.mTabSpinner.setSelection(this.mSelectedTabIndex); } }
private void checkInterfaceOrientation(Configuration config) { Boolean isLandscape = (config.orientation == Configuration.ORIENTATION_LANDSCAPE); if (isLandscape) { // mAnimloading.setVisibility(View.VISIBLE); WindowManager.LayoutParams lp = getwindow().getAttributes(); lp.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN; getwindow().setAttributes(lp); getwindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); // new LoadReportData().execute(); } else { WindowManager.LayoutParams attr = getwindow().getAttributes(); attr.flags &= (~WindowManager.LayoutParams.FLAG_FULLSCREEN); getwindow().setAttributes(attr); getwindow().clearFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); } }
public ScrollingTabContainerView(Context context) { super(context); setHorizontalScrollBarEnabled(false); ActionBarPolicy abp = ActionBarPolicy.get(context); setContentHeight(abp.getTabContainerHeight()); this.mStackedTabMaxWidth = abp.getStackedTabMaxWidth(); this.mTabLayout = createTabLayout(); addView(this.mTabLayout,-1)); }
private boolean performExpand() { if (isCollapsed()) { removeView(this.mTabSpinner); addView(this.mTabLayout,-1)); setTabSelected(this.mTabSpinner.getSelectedItemPosition()); } return false; }
private LinearLayoutCompat createTabLayout() { LinearLayoutCompat tabLayout = new LinearLayoutCompat(getContext(),null,R.attr.actionBarTabBarStyle); tabLayout.setMeasureWithLargestChildEnabled(true); tabLayout.setGravity(17); tabLayout.setLayoutParams(new LayoutParams(-2,-1)); return tabLayout; }
private TabView createTabView(Tab tab,boolean forAdapter) { TabView tabView = new TabView(getContext(),tab,forAdapter); if (forAdapter) { tabView.setBackgroundDrawable(null); tabView.setLayoutParams(new AbsListView.LayoutParams(-1,this.mContentHeight)); } else { tabView.setFocusable(true); if (this.mTabClickListener == null) { this.mTabClickListener = new TabClickListener(); } tabView.setonClickListener(this.mTabClickListener); } return tabView; }
public void addTab(Tab tab,boolean setSelected) { TabView tabView = createTabView(tab,false); this.mTabLayout.addView(tabView,new LayoutParams(0,-1,1.0f)); if (this.mTabSpinner != null) { ((TabAdapter) this.mTabSpinner.getAdapter()).notifyDataSetChanged(); } if (setSelected) { tabView.setSelected(true); } if (this.mAllowCollapse) { requestLayout(); } }
public void addTab(Tab tab,int position,position,1.0f)); if (this.mTabSpinner != null) { ((TabAdapter) this.mTabSpinner.getAdapter()).notifyDataSetChanged(); } if (setSelected) { tabView.setSelected(true); } if (this.mAllowCollapse) { requestLayout(); } }
private boolean performExpand() { if (!isCollapsed()) { return false; } removeView(this.mTabSpinner); addView(this.mTabLayout,-1)); setTabSelected(this.mTabSpinner.getSelectedItemPosition()); return false; }
private Spinner createSpinner() { Spinner spinner = new AppCompatSpinner(getContext(),R.attr.actionDropDownStyle); spinner.setLayoutParams(new LayoutParams(-2,-1)); spinner.setonItemSelectedListener(this); return spinner; }
android.support.v7.widget.LinearLayoutCompat的实例源码
/** * 初始化默认的HeaderView 与 FooterView * * @param context */ private void init(Context context) { // inflate得到的view需要代码设置LayoutParams // HeaderView mHeaderView = LinearLayoutCompat.inflate(context,R.layout.recyclerview_refresh_headerview,null); mHeaderViewStateIcon = mHeaderView.findViewById(R.id.refresh_headerview_stateIcon); mHeaderViewHint = (TextView) mHeaderView.findViewById(R.id.refresh_headerview_hint); mHeaderViewLastRefreshTime = (TextView) mHeaderView.findViewById(R.id.refresh_headerview_lastRefreshTime); // 直接从布局中获取高度即可 mHeaderViewHeight = getResources().getDimensionPixelOffset(R.dimen.recyclerview_refresh_headerview_height); // 这里需要手动设置LayoutParams,否则getLayoutParams为空 // 并且,在使用inflate得到的布局,没有设置手动设置LayoutParams的情况下,有些布局会出问题,特别是使用LinearLayout时。 RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,mHeaderViewHeight); lp.setMargins(0,-mHeaderViewHeight,0); mHeaderView.setLayoutParams(lp); mHeaderView.requestLayout(); // FooterView mFooterView = LinearLayoutCompat.inflate(context,R.layout.recyclerview_refresh_footerview,null); mFooterViewStateIcon = mFooterView.findViewById(R.id.refresh_footerview_stateIcon); mFooterViewHint = (TextView) mFooterView.findViewById(R.id.refresh_footerview_hint); }
@Override public void showEvents(List<DetailEvent> events) { int headerHeight = getResources().getDimensionPixelSize(R.dimen.header_bg_height); rvDetailEvents.setLayoutManager(new linearlayoutmanager(getActivity())); mAdapter = new DetailEventAdapter(events,headerHeight); View view = new View(getActivity()); view.setLayoutParams(new LinearLayoutCompat.LayoutParams(-1,headerHeight)); mAdapter.addHeaderView(view); rvDetailEvents.setAdapter(mAdapter); // final StickyRecyclerHeadersdecoration header = new StickyRecyclerHeadersdecoration(mAdapter); // rvDetailEvents.addItemdecoration(header); rvDetailEvents.addItemdecoration(new DividerItemdecoration(getActivity(),DividerItemdecoration.VERTICAL)); rvDetailEvents.setItemAnimator(new SlideInLeftAnimator()); rvDetailEvents.getItemAnimator().setAddDuration(500); rvDetailEvents.getItemAnimator().setRemoveDuration(500); }
private void initBottomSheetItem() { LinearLayoutCompat takePhoto = mView.findViewById(R.id.bottom_sheet_item_take_photo); LinearLayoutCompat chooseImage = mView.findViewById(R.id.bottom_sheet_item_choose_image); LinearLayoutCompat recording = mView.findViewById(R.id.bottom_sheet_item_recording); LinearLayoutCompat movetoTrash = mView.findViewById(R.id.bottom_sheet_item_move_to_trash); LinearLayoutCompat permanentDelete = mView.findViewById(R.id.bottom_sheet_item_permanent_delete); LinearLayoutCompat makeAcopy = mView.findViewById(R.id.bottom_sheet_item_make_a_copy); LinearLayoutCompat send = mView.findViewById(R.id.bottom_sheet_item_send); takePhoto.setonClickListener(this); chooseImage.setonClickListener(this); recording.setonClickListener(this); movetoTrash.setonClickListener(this); permanentDelete.setonClickListener(this); makeAcopy.setonClickListener(this); send.setonClickListener(this); }
private void initMenuItems() { for (int i = 0; i < getChildCount() - 1; i++) { View item = getChildAt(i); item.setonClickListener(new OnClickListener() { @Override public void onClick(View view) { if(null !=mOnMenuItemClickListener) { mOnMenuItemClickListener.onMenuItemClick((FloatingActionButton) view,view.getId()); } collapse(); } }); LayoutParams params = (LinearLayoutCompat.LayoutParams) item.getLayoutParams(); params.topMargin = getResources().getDimensionPixelSize(R.dimen.fab_margin); } }
public oaDialog(Context context,final Tools.oaCallBack callBack) { super(context); super.requestwindowFeature(Window.FEATURE_NO_TITLE); super.setContentView(R.layout.custom_dialog); displayMetrics metrics = context.getResources().getdisplayMetrics(); int width = metrics.widthPixels; super.getwindow().setLayout(width - 10,LinearLayoutCompat.LayoutParams.WRAP_CONTENT); relativeLayout = find(R.id.layout_actionbar); imageTitle = find(R.id.imagetitle); text = find(R.id.contenttext); inputlayout = find(R.id.textinputlayout); ((Button) find(R.id.button_ok)).setonClickListener(new View.OnClickListener() { @Override public void onClick(View view) { callBack.returnString(text.getText().toString()); oaDialog.super.dismiss(); } }); }
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_episode,container,false); img_thmb = (ImageView) view.findViewById(R.id.img_thumb); txt_name = (TextView) view.findViewById(R.id.txt_name); txt_date = (TextView) view.findViewById(R.id.txt_date); txt_plot = (TextView) view.findViewById(R.id.txt_plot); txt_subs = (TextView) view.findViewById(R.id.txt_subs); Box_gues = (LinearLayoutCompat) view.findViewById(R.id.Box_gues); txt_gues = (TextView) view.findViewById(R.id.txt_guests); Box_writ = (LinearLayoutCompat) view.findViewById(R.id.Box_writ); txt_writ = (TextView) view.findViewById(R.id.txt_writers); Box_dire = (LinearLayoutCompat) view.findViewById(R.id.Box_dire); txt_dire = (TextView) view.findViewById(R.id.txt_director); return view; }
private void init(Context context,int childCount) { LinearLayoutCompat.LayoutParams layoutParams = new LinearLayoutCompat.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT); layoutParams.gravity = Gravity.CENTER_VERTICAL; this.setLayoutParams(layoutParams); this.childCount = childCount; this.setorientation(LinearLayoutCompat.VERTICAL); if (this.childCount > 0) { LinearLayout.LayoutParams childParams = new LinearLayout.LayoutParams((CircleAppConstants.viewHeight)/ 5,(CircleAppConstants.viewHeight) / 5); childParams.gravity = Gravity.CENTER_VERTICAL|Gravity.CENTER_HORIZONTAL; for(int i = 0; i< this.childCount; i++){ ChildCircleContainer childCircleContainer = new ChildCircleContainer(getContext(),(CircleAppConstants.viewHeight),onChildClick); childCircleContainer.setPadding(10,10,10); childCircleContainer.setLayoutParams(childParams); this.addView(childCircleContainer); } } }
public void addTab(android.support.v7.app.ActionBar.Tab tab,int i,boolean flag) { tab = createTabView(tab,false); mTabLayout.addView(tab,i,new android.support.v7.widget.LinearLayoutCompat.LayoutParams(0,-1,1.0F)); if (mTabSpinner != null) { ((TabAdapter)mTabSpinner.getAdapter()).notifyDataSetChanged(); } if (flag) { tab.setSelected(true); } if (mAllowCollapse) { requestLayout(); } }
public void addTab(android.support.v7.app.ActionBar.Tab tab,1.0F)); if (mTabSpinner != null) { ((TabAdapter)mTabSpinner.getAdapter()).notifyDataSetChanged(); } if (flag) { tab.setSelected(true); } if (mAllowCollapse) { requestLayout(); } }
/** * transform to ViewPager * * @param recyclerView {@link RecyclerView} * @param orientation the orientation of Linearlayout */ public static void toViewPager(RecyclerView recyclerView,@LinearLayoutCompat.OrientationMode int orientation) { recyclerView.setLayoutManager(new linearlayoutmanager(recyclerView.getContext(),orientation,false)); new PagerSnapHelper().attachToRecyclerView(recyclerView); }
private void init(Context context,AttributeSet attrs) { TypedArray typedArray = context.obtainStyledAttributes(attrs,R.styleable.BackgroundProgress); try { showTxt = typedArray.getString(R.styleable.BackgroundProgress_showTxt); isGradient = typedArray.getBoolean(R.styleable.BackgroundProgress_isGradient,true); } catch (Exception e) { showTxt = null; isGradient = true; } typedArray.recycle(); View view = LayoutInflater.from(context).inflate(R.layout.bp,null); backgroundProgressView = (BackgroundProgressView) view.findViewById(R.id.progress); tv = (TextView) view.findViewById(R.id.tv); if (TextUtils.isEmpty(showTxt)) { tv.setVisibility(GONE); } else { tv.setText(showTxt); } backgroundProgressView.set_isGradient(isGradient); ViewGroup.LayoutParams layoutParams = new LinearLayoutCompat.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT); addView(view,layoutParams); }
@Override public RecyclerView.ViewHolder onCreateHeaderViewHolder(ViewGroup parent) { View view = new View(parent.getContext()); view.setLayoutParams(new LinearLayoutCompat.LayoutParams(-1,headerHeight)); return new RecyclerView.ViewHolder(view) { }; }
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_right_sample); sv = (StretchView) findViewById(R.id.sv); sv.setDrawHelper(new ArcDrawHelper(sv,ContextCompat.getColor(RightSampleActivity.this,R.color.colorPrimary),40)); rcv = (RecyclerView) findViewById(R.id.rcv); rcv.setLayoutManager(new linearlayoutmanager(RightSampleActivity.this,linearlayoutmanager.HORIZONTAL,false)); rcv.addItemdecoration(new Rcvdecoration(0,(int) getResources().getDimension(R.dimen.divider_horzontal),LinearLayoutCompat.HORIZONTAL)); rcv.setAdapter(new RecyclerView.Adapter() { @Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent,int viewType) { return new VH(LayoutInflater.from(RightSampleActivity.this).inflate(R.layout.item_horizontal,parent,false)); } @Override public void onBindViewHolder(RecyclerView.ViewHolder holder,int position) { } @Override public int getItemCount() { return 10; } }); }
/** * get the item_vertical top spacing * * @param itemPosition itemPosition * @return int */ private int getItemTopSpacing(int itemPosition) { if (isFirstItem(itemPosition) && orientation == LinearLayoutCompat.VERTICAL) { return verticalItemSpacingInPx; } return verticalItemSpacingInPx >> 1; }
@SuppressWarnings("unchecked") private void onChage() { removeAllViews(); for (int i = 0; i < mTAdapter.getCount(); ++i) { View tabView = mTAdapter.getView(i,this,mTAdapter.getItem(i)); LinearLayoutCompat.LayoutParams layoutParams = new LayoutParams(0,-1); layoutParams.weight = 1; addView(tabView,layoutParams); } invalidate(); }
public ReviewLabelsView(Context context,AttributeSet attrs,int defStyleAttr) { super(context,attrs,defStyleAttr); setorientation(HORIZONTAL); mAccount = Preferences.getAccount(context); // Separate labels and scores mLabelsLayout = new LinearLayout(context); mLabelsLayout.setorientation(LinearLayout.VERTICAL); addView(mLabelsLayout,new LinearLayoutCompat.LayoutParams(WRAP_CONTENT,WRAP_CONTENT)); mscoresLayout = new LinearLayout(context); mscoresLayout.setorientation(LinearLayout.VERTICAL); addView(mscoresLayout,WRAP_CONTENT)); }
/** * Called to create the ViewHolder at the given position. * * @param parent parent to assign the newly created view to * @param viewType ignored */ @Override public CategoryViewHolder onCreateViewHolder(ViewGroup parent,int viewType) { View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item_category,false); v.setLayoutParams(new LinearLayoutCompat.LayoutParams(LinearLayoutCompat.LayoutParams.MATCH_PARENT,LinearLayoutCompat.LayoutParams.WRAP_CONTENT)); return new CategoryViewHolder(v,mListener); }
/** * Called to create the ViewHolder at the given position. * * @param parent parent to assign the newly created view to * @param viewType ignored */ @Override public StatisticViewHolder onCreateViewHolder(ViewGroup parent,int viewType) { View v; int layout; Context parentContext = parent.getContext(); if (viewType == StatisticViewHolder.TYPE_LARGE) { layout = R.layout.list_item_statistic_most_played; } else if (viewType == StatisticViewHolder.TYPE_SMALL) { layout = R.layout.list_item_statistic_pie_chart; } else { throw new RuntimeException("Invalid view type!"); } v = LayoutInflater.from(parentContext).inflate(layout,false); LinearLayoutCompat.LayoutParams layoutParams = new LinearLayoutCompat.LayoutParams( LinearLayoutCompat.LayoutParams.MATCH_PARENT,LinearLayoutCompat.LayoutParams.WRAP_CONTENT); v.setLayoutParams(layoutParams); return new StatisticViewHolder(v,mUserLogicFactory,mChallengeDataSource,mApplication,mUser,mCategoryId); }
public FooterViewHolder(View itemView) { super(itemView); ButterKnife.bind(this,itemView); LinearLayoutCompat.LayoutParams params = new LinearLayoutCompat.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ScreenUtil.instance(mContext).dip2px(40)); itemView.setLayoutParams(params); }
public static SubjectFactory<LinearLayoutCompatSubject,LinearLayoutCompat> type() { return new SubjectFactory<LinearLayoutCompatSubject,LinearLayoutCompat>() { @Override public LinearLayoutCompatSubject getSubject(FailureStrategy fs,LinearLayoutCompat that) { return new LinearLayoutCompatSubject(fs,that); } }; }
private void setupControlPanel() { controlPanel = (LinearLayoutCompat) findViewById(R.id.control); bulletButton = (StatusImageButton) findViewById(R.id.bullet); quoteButton = (StatusImageButton) findViewById(R.id.quote); attachmentButton = (AppCompatimageButton) findViewById(R.id.attachment); dotsButton = (AppCompatimageButton) findViewById(R.id.dots); playButton = (AppCompatimageButton) findViewById(R.id.play); bulletButton.setonClickListener(this); quoteButton.setonClickListener(this); attachmentButton.setonClickListener(this); dotsButton.setonClickListener(this); playButton.setonClickListener(this); bulletButton.setonLongClickListener(this); quoteButton.setonLongClickListener(this); attachmentButton.setonLongClickListener(this); dotsButton.setonLongClickListener(this); playButton.setonLongClickListener(this); RxBus.getInstance().toObservable(BlockEvent.class) .subscribe(new Action1<BlockEvent>() { @Override public void call(BlockEvent event) { bulletButton.setActivated(event.isBullet()); quoteButton.setActivated(event.isQuote()); } }); }
private void setupStylePanel() { stylePanel = (LinearLayoutCompat) findViewById(R.id.style); boldButton = (StatusImageButton) findViewById(R.id.bold); italicButton = (StatusImageButton) findViewById(R.id.italic); underlineButton = (StatusImageButton) findViewById(R.id.underline); strikethroughButton = (StatusImageButton) findViewById(R.id.strikethrough); linkButton = (StatusImageButton) findViewById(R.id.link); boldButton.setonClickListener(this); italicButton.setonClickListener(this); underlineButton.setonClickListener(this); strikethroughButton.setonClickListener(this); linkButton.setonClickListener(this); boldButton.setonLongClickListener(this); italicButton.setonLongClickListener(this); underlineButton.setonLongClickListener(this); strikethroughButton.setonLongClickListener(this); linkButton.setonLongClickListener(this); RxBus.getInstance().toObservable(FormatEvent.class) .subscribe(new Action1<FormatEvent>() { @Override public void call(FormatEvent event) { boldButton.setActivated(event.isBold()); italicButton.setActivated(event.isItalic()); underlineButton.setActivated(event.isUnderline()); strikethroughButton.setActivated(event.isstrikethrough()); linkButton.setActivated(event.isLink()); } }); }
private void setTopLayoutData() { if (mMzitutopModelList == null || mMzitutopModelList.size() < 4 || topView != null) { return; } topView = LayoutInflater.from(mContext).inflate(R.layout.mzitu_header_top,null,false); mTopLayout = (LinearLayout) topView.findViewById(R.id.mTopLayout); for (final MzituModel item : mMzitutopModelList) { ImageView mImage = new ImageView(mContext); mImage.setLayoutParams(new LinearLayoutCompat.LayoutParams(UtilsDynamicSize.defaultdisplayWidth / 4,UtilsDynamicSize.defaultdisplayWidth / 4)); mImage.setPadding(4,4,0); Glide.with(mContext) .load(item.imagePath)//目标URL .placeholder(R.drawable.load_image_ing) .error(R.drawable.load_image_fail) //图片获取失败时默认显示的图片 .diskCacheStrategy(diskCacheStrategy.ALL) //缓存全尺寸图片,也缓存其他尺寸图片 .centerCrop() .crossFade().into(mImage); mImage.setonClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (!UtilsViewEvent.isFastDoubleClick()) { getDetailData(item.link); } } }); mTopLayout.addView(mImage); } mRecyclerView.addHeaderView(topView); mRefreshAdapter.setHeaderViewsNumber(mRecyclerView.getTopViewCount()); }
private void createMenuLayout() { mMenuLayout = new LinearLayoutCompat(getContext()); LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT); mMenuLayout.setId(genViewId()); addView(mMenuLayout,layoutParams); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { mMenuLayout.setPaddingrelative(0,0); } else { mMenuLayout.setPadding(0,0); } }
protected final void onMeasure(int paramInt1,int paramInt2) { LinearLayoutCompat localLinearLayoutCompat = this.mActivityChooserContent; if (this.mDefaultActivityButton.getVisibility() != 0) { paramInt2 = View.MeasureSpec.makeMeasureSpec(View.MeasureSpec.getSize(paramInt2),1073741824); } measureChild(localLinearLayoutCompat,paramInt1,paramInt2); setMeasuredDimension(localLinearLayoutCompat.getMeasuredWidth(),localLinearLayoutCompat.getMeasuredHeight()); }
private void generateThumbnail(String url,final int position,int size) { ImageView imageView = new ImageView(this); imageView.setLayoutParams(new LinearLayoutCompat.LayoutParams(size,size)); imageView.setBackgroundResource(R.drawable.thumbnail_bg); Picasso.with(this).load(url).fit().centerInside().into(imageView); imageView.setonClickListener(new View.OnClickListener() { @Override public void onClick(View v) { imagesPager.setCurrentItem(position,true); } }); thumbnails.addView(imageView); }
private void init(Context context,int width) { LinearLayoutCompat.LayoutParams layoutParams = new LinearLayoutCompat.LayoutParams((int)(width),(int)(width)); layoutParams.gravity = Gravity.CENTER_VERTICAL| Gravity.CENTER_HORIZONTAL; this.setLayoutParams(layoutParams); LeftOuterCircleView leftOuterCircleView1 = new LeftOuterCircleView(context,width,false); LeftOuterCircleView leftOuterCircleView2 = new LeftOuterCircleView(context,(width - 40 ),true); circleTitleView = new CircleTitleView(context,(int) (width)); circleTitleView.setTextColor(getContext().getResources().getColor(android.R.color.white)); circleTitleView.setTextSize(20); circleTitleView.setTypeface(Typeface.DEFAULT,Typeface.BOLD_ITALIC); circleTitleView.setText("App Name"); this.addView(leftOuterCircleView1); this.addView(leftOuterCircleView2); addCircle(1,width - 78,(float) 0.0,0.85); addCircle(2,width - 150,0.97); addCircle(3,width - 170,0.97); addCircle(4,width - 190,0.98); addCircle(5,width - 210,0.98); addCircle(6,width - 230,0.85); addCircle(7,width - 280,0.85); addCircle(0,width - 35,0.9); addCircle(0,width - 92,(float)0.1,0.9); this.addView(circleTitleView); animateClockwise(leftOuterCircleView1); animateAntiClockwise(leftOuterCircleView2); }
public HorizontalPicker(Context context,defStyleAttr); setorientation(VERTICAL); header = new LinearLayout(context); header.setorientation(LinearLayout.HORIZONTAL); float density = getResources().getdisplayMetrics().density; addView(header,new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,(int) (density * 56))); mDetailContainer = new FrameLayout(context); addView(mDetailContainer,new LinearLayoutCompat.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.WRAP_CONTENT)); }
public void onResume() { super.onResume(); Window window = getDialog().getwindow(); window.setLayout(LinearLayoutCompat.LayoutParams.WRAP_CONTENT,getResources().getDimensionPixelSize(R.dimen.dialog_height)); }
private Spinner createSpinner() { AppCompatSpinner appcompatspinner = new AppCompatSpinner(getContext(),android.support.v7.appcompat.R.attr.actionDropDownStyle); appcompatspinner.setLayoutParams(new android.support.v7.widget.LinearLayoutCompat.LayoutParams(-2,-1)); appcompatspinner.setonItemSelectedListener(this); return appcompatspinner; }
private LinearLayoutCompat createTabLayout() { LinearLayoutCompat linearlayoutcompat = new LinearLayoutCompat(getContext(),android.support.v7.appcompat.R.attr.actionBarTabBarStyle); linearlayoutcompat.setMeasureWithLargestChildEnabled(true); linearlayoutcompat.setGravity(17); linearlayoutcompat.setLayoutParams(new android.support.v7.widget.LinearLayoutCompat.LayoutParams(-2,-1)); return linearlayoutcompat; }
protected void onMeasure(int i,int j) { LinearLayoutCompat linearlayoutcompat = mActivityChooserContent; int k = j; if (mDefaultActivityButton.getVisibility() != 0) { k = android.view.View.MeasureSpec.makeMeasureSpec(android.view.View.MeasureSpec.getSize(j),0x40000000); } measureChild(linearlayoutcompat,k); setMeasuredDimension(linearlayoutcompat.getMeasuredWidth(),linearlayoutcompat.getMeasuredHeight()); }
public static void chatsExplorationTutorial(final Activity activity,final LinearLayoutCompat hueLayout) { PreferencesManager manager = new PreferencesManager(activity); if (!manager.isdisplayed(SE_ROOMS_TAB)) { ChatroomsExplorationActivity.touchesBlocked = true; } if (mCategoryConfig == null) { setCategoryConfig(activity); } ArrayList<View> seTxtView = new ArrayList<>(); final ArrayList<View> soTxtView = new ArrayList<>(); hueLayout.getChildAt(0).findViewsWithText(seTxtView,"SE",View.FIND_VIEWS_WITH_TEXT); hueLayout.getChildAt(1).findViewsWithText(soTxtView,"SO",View.FIND_VIEWS_WITH_TEXT); SpotlightView SErooms = new SpotlightView.Builder(activity) .target(seTxtView.get(0)) .usageId(SE_ROOMS_TAB) .setConfiguration(mCategoryConfig) .headingTvText(activity.getResources().getString(R.string.CEA_SErooms_tab_tutorial_heading)) .subheadingTvText(activity.getResources().getString(R.string.CEA_SErooms_tab_tutorial_text)) .show(); final SpotlightView.Builder SOrooms = new SpotlightView.Builder(activity) .setConfiguration(mCategoryConfig) .headingTvText(activity.getResources().getString(R.string.CEA_SOrooms_tab_tutorial_heading)) .subheadingTvText(activity.getResources().getString(R.string.CEA_SOrooms_tab_tutorial_text)) .usageId(SO_ROOMS_TAB); SpotlightListener listener = new SpotlightListener() { @Override public void onUserClicked(String s) { switch (s) { case SE_ROOMS_TAB: ChatroomsExplorationActivity.touchesBlocked = true; SOrooms.target(soTxtView.get(0)).show(); break; case SO_ROOMS_TAB: ChatroomsExplorationActivity.touchesBlocked = false; break; } } @Override public void onFinishedDrawingSpotlight() { ChatroomsExplorationActivity.touchesBlocked = false; } @Override public void onStartedDrawingSpotlight() { ChatroomsExplorationActivity.touchesBlocked = false; } }; SErooms.setListener(listener); SOrooms.setListener(listener); }
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_linear_layout_compat); mLlc = (LinearLayoutCompat) findViewById(R.id.llc); }
public void beginning(View view) { mLlc.setShowDividers(LinearLayoutCompat.SHOW_DIVIDER_BEGINNING); }
public void middle(View view) { mLlc.setShowDividers(LinearLayoutCompat.SHOW_DIVIDER_MIDDLE); }
public void end(View view) { mLlc.setShowDividers(LinearLayoutCompat.SHOW_DIVIDER_END); }
private int getItemLeftSpace(int itemPosition) { if (isFirstItem(itemPosition) && orientation == LinearLayoutCompat.HORIZONTAL) { return horizontalItemSpacingInPx; } return horizontalItemSpacingInPx >> 1; }
private int getItemRightSpace(int itemPosition,int childCount) { if (isLastItem(itemPosition,childCount) && orientation == LinearLayoutCompat.HORIZONTAL) { return horizontalItemSpacingInPx; } return horizontalItemSpacingInPx >> 1; }
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { final AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(getActivity()); alertDialogBuilder.setTitle("All Slot information"); alertDialogBuilder.setMessage("Following slots have been configured in the beacon"); final View alertDialogView = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_all_slot_info,null); final LinearLayout slottitleContainer = (LinearLayout) alertDialogView.findViewById(R.id.slot_title_container); final LinearLayout slotInfoContainer = (LinearLayout) alertDialogView.findViewById(R.id.slot_info_container); LinearLayout.LayoutParams lParams = new LinearLayout.LayoutParams(LinearLayoutCompat.LayoutParams.WRAP_CONTENT,LinearLayout.LayoutParams.WRAP_CONTENT); for(int i = 0; i < mAllSlotInfo.size(); i++) { TextView slottitle = new TextView(getActivity()); slottitle.setLayoutParams(lParams); slottitle.setText("Slot " + i + ":"); slottitleContainer.addView(slottitle); TextView slotInfo = new TextView(getActivity()); slotInfo.setLayoutParams(lParams); slotInfo.setText(mAllSlotInfo.get(i)); slotInfoContainer.addView(slotInfo); if(i > 0){ lParams.setMargins(0,0); } } final AlertDialog alertDialog = alertDialogBuilder.setView(alertDialogView).setPositiveButton(getString(R.string.ok),null).show(); alertDialog.setCanceledOnTouchOutside(false); alertDialog.getButton(DialogInterface.BUTTON_POSITIVE).setonClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dismiss(); } }); return alertDialog; }
android.support.v7.widget.LinearLayoutManager的实例源码
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_journal_list,container,false); // Set the adapter if (view instanceof RecyclerView) { FirebaseDatabase dbRef = FirebaseDatabase.getInstance(); FirebaseAuth auth = FirebaseAuth.getInstance(); FirebaseUser user = auth.getCurrentUser(); DatabaseReference userRef = dbRef.getReference(user.getUid()); userRef.addChildEventListener (chEvListener); userRef.addValueEventListener(valEvListener); Context context = view.getContext(); RecyclerView recyclerView = (RecyclerView) view; if (mColumnCount <= 1) { recyclerView.setLayoutManager(new linearlayoutmanager(context)); } else { recyclerView.setLayoutManager(new GridLayoutManager(context,mColumnCount)); } adapter = new JournalAdapter(allTrips,mListener); recyclerView.setAdapter(adapter); } return view; }
private void init(){ for (int i = 0 ;i < themeType.length;i++){ ThemeInfo info = new ThemeInfo(); info.setName(themeType[i]); info.setColor(colors[i]); info.setSelect((selectTheme == i) ? true : false); if (i == themeType.length-1){ info.setBackground(R.color.nightBg); }else { info.setBackground(R.color.colorWhite); } themeInfoList.add(info); } recyclerView = (RecyclerView)findViewById(R.id.theme_rv); adapter = new ThemeAdapter(); linearlayoutmanager linearlayoutmanager = new linearlayoutmanager(this); linearlayoutmanager.setorientation(linearlayoutmanager.VERTICAL); recyclerView.setLayoutManager(linearlayoutmanager); recyclerView.setAdapter(adapter); }
@Override protected void initData() { List<Itemmodel> items = new ArrayList<>(); fillData(items); adapter = new MainAdapter(items); adapter.openLoadAnimation(BaseQuickAdapter.SCALEIN); adapter.isFirstOnly(false); adapter.setonLoadMoreListener(this); refreshLayout.setColorSchemeColors(Color.RED,Color.BLUE,Color.GREEN); refreshLayout.setonRefreshListener(this); recyclerView.setLayoutManager(new linearlayoutmanager(context)); recyclerView.setItemAnimator(new DefaultItemAnimator()); recyclerView.addItemdecoration(new DividerItemdecoration(context,linearlayoutmanager.VERTICAL)); recyclerView.setAdapter(adapter); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); RecyclerView rcViewList = (RecyclerView) findViewById(R.id.rc_item); rcViewList.setAdapter(new ItemAdapter(generateFakeItems(),new OnItemClickListener() { @Override public void onItemClick(int position) { startActivity(new Intent(MainActivity.this,FragmentPagerActivity.class)); } })); rcViewList.setLayoutManager(new linearlayoutmanager(this)); rcViewList.addItemdecoration(new DividerItemdecoration(this,DividerItemdecoration.VERTICAL)); }
private void initView(List<String> list) { Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setdisplayHomeAsUpEnabled(true); recyclerView = (RecyclerView) findViewById(R.id.recyclerView); recyclerView.setHasFixedSize(true); linearlayoutmanager = new linearlayoutmanager(this); linearlayoutmanager.setSmoothScrollbarEnabled(true); recyclerView.setLayoutManager(linearlayoutmanager); ListRecyclerAdapter adapter = new ListRecyclerAdapter(list); recyclerView.setAdapter(adapter); FAB = (FloatingActionButton) findViewById(R.id.fab); FAB.setonClickListener(new View.OnClickListener() { @Override public void onClick(View v) { linearlayoutmanager.scrollToPosition(0); hideFAB(); } }); }
private void setVideoRelated() { List<VideoDetailsInfo.DataBean.RelatesBean> relates = mVideoDetailsInfo.getRelates(); if (relates == null) { mVideoRelatedLayout.setVisibility(View.GONE); return; } VideoRelatedAdapter mVideoRelatedAdapter = new VideoRelatedAdapter(mRecyclerView,relates); mRecyclerView.setHasFixedSize(false); mRecyclerView.setnestedScrollingEnabled(false); mRecyclerView.setLayoutManager( new linearlayoutmanager(getActivity(),linearlayoutmanager.VERTICAL,true)); mRecyclerView.setAdapter(mVideoRelatedAdapter); mVideoRelatedAdapter.setonItemClickListener( (position,holder) -> VideoDetailsActivity.launch(getActivity(),relates.get(position).getAid(),relates.get(position).getPic())); }
@Override public int computealignOffset(int offset,boolean isLayoutEnd,boolean useAnchor,LayoutManagerHelper helper) { //Log.d(TAG,// "range " + getRange() + " offset " + offset + " isLayoutEnd " + isLayoutEnd + " useAnchor " + useAnchor // + " helper " + this.hashCode()); final boolean layoutInVertical = helper.getorientation() == linearlayoutmanager.VERTICAL; if (useAnchor) { return 0; } if (isLayoutEnd) { if (offset == getItemCount() - 1) { return layoutInVertical ? mMarginBottom + mPaddingBottom : mMarginRight + mPaddingRight; } } else { if (offset == 0) { return layoutInVertical ? -mMarginTop - mPaddingTop : -mMarginLeft - mPaddingLeft; } } return 0; }
/** * 计算每个Item的宽度 */ public int getItemWidth() { final LayoutManager layoutManager = getLayoutManager(); int itemWidth = 0; if (layoutManager instanceof GridLayoutManager) { final GridLayoutManager gridLayoutManager = (GridLayoutManager) layoutManager; final int spanCount = gridLayoutManager.getSpanCount(); if (gridLayoutManager.getorientation() == linearlayoutmanager.HORIZONTAL) { itemWidth = getRawWidth() / (mItemCount / spanCount); } else { itemWidth = getRawWidth() / spanCount; } } else if (layoutManager instanceof linearlayoutmanager) { final linearlayoutmanager linearlayoutmanager = (linearlayoutmanager) layoutManager; if (linearlayoutmanager.getorientation() == linearlayoutmanager.HORIZONTAL) { itemWidth = getRawWidth() / mItemCount; } else { itemWidth = getRawWidth(); } } return itemWidth; }
@Override protected void onCreate(Bundle savedInstanceState) { AndroidInjection.inject(this); super.onCreate(savedInstanceState); binding = DataBindingUtil.setContentView(this,R.layout.activity_heroes_list); context = this; linearlayoutmanager linearlayoutmanager = new linearlayoutmanager(context,false); DividerItemdecoration dividerItemdecoration = new DividerItemdecoration(context,linearlayoutmanager.getorientation()); binding.rvHeroes.setLayoutManager(linearlayoutmanager); binding.rvHeroes.addItemdecoration(dividerItemdecoration); binding.rvHeroes.setAdapter(heroesAdapter); binding.fastScroll.setRecyclerView(binding.rvHeroes); heroesAdapter.setonClickListener(position -> presenter.onSuperHeroClicked(position)); binding.btnTryAgain.setonClickListener(v -> presenter.getSuperHeroes()); binding.btnTryAgain.performClick(); }
private void setUpRecyclerView() { if(mTask.getAttachments().size() > 0) { mAttachmentsSubtitle.setVisibility(View.VISIBLE); mLayoutManager = new linearlayoutmanager(this,false); mAdapter = new AttachmentAdapter(this,mTask.getAttachments(),true); mAdapter.setAttachmentDataUpdatedListener(new AttachmentAdapter.AttachmentDataUpdatedListener() { @Override public void onAttachmentDataUpdated() { mTaskDataUpdated = true; } }); DividerItemdecoration itemdecoration = new DividerItemdecoration(this,mLayoutManager.getorientation()); itemdecoration.setDrawable(ContextCompat.getDrawable(this,R.drawable.item_decoration_half_line)); mRecyclerView.addItemdecoration(itemdecoration); mRecyclerView.setnestedScrollingEnabled(false); mRecyclerView.setLayoutManager(mLayoutManager); mRecyclerView.setAdapter(mAdapter); } }
private BounceMenu(View view,int resId,final MyAdapter myAdapter) { parentVG = findParentVG(view); rootView = LayoutInflater.from(view.getContext()).inflate(resId,null,false); recyclerView = (RecyclerView) rootView.findViewById(R.id.recyclerview); bounceView = (BounceView) rootView.findViewById(R.id.bounceview); recyclerView.setLayoutManager(new linearlayoutmanager(view.getContext())); bounceView.setAnimatorListener(new BounceView.BounceAnimatorListener() { @Override public void showContent() { recyclerView.setVisibility(View.VISIBLE); recyclerView.setAdapter(myAdapter); recyclerView.scheduleLayoutAnimation(); } }); }
private void setUpInfo(View view) { RecyclerView rvInfo = (RecyclerView) view.findViewById(R.id.rv_movie_detail_info); ArrayList<ItemInfo> infoItems = new ArrayList<>(); String overviewValStr = view.getResources().getString(R.string.lorem_ipsum_long); infoItems.add(new ItemInfo("Overview",overviewValStr)); infoItems.add(new ItemInfo("Tagline","Divided We Fall")); infoItems.add(new ItemInfo("Status","Releases")); infoItems.add(new ItemInfo("Budget","250.000.000")); infoItems.add(new ItemInfo("Revenue","1.153.304.495")); infoItems.add(new ItemInfo("Homepage","http://marvel.com/captainamericapremiere")); RecyclerAdapter infoAdapter = new RecyclerAdapter<ItemInfo,MovieInfoViewHolder>( R.layout.item_movie_info,ItemInfo.class,infoItems,MovieInfoViewHolder.class) { @Override protected void bindView(MovieInfoViewHolder holder,ItemInfo model,int position) { holder.getLabel().setText(model.getLabel()); holder.getValue().setText(model.getValue()); } }; rvInfo.setLayoutManager(new linearlayoutmanager(view.getContext())); rvInfo.setAdapter(infoAdapter); rvInfo.addItemdecoration(new MovieInfoViewHolder.Itemdecoration()); }
@Override public void onScrollStateChanged(RecyclerView recyclerView,int newState) { super.onScrollStateChanged(recyclerView,newState); RecyclerView.LayoutManager layoutManager = recyclerView.getLayoutManager(); if (layoutManager instanceof linearlayoutmanager) { linearlayoutmanager linearManager = (linearlayoutmanager) layoutManager; int firstItemPosition = linearManager.findFirstVisibleItemPosition(); if(firstItemPosition == 0 || mContentlistadapter.getItemCount() == 0){ mRefreshLayout.setEnabled(true); CFLog.e("V2MainFragment","arrive top"); } else{ mRefreshLayout.setEnabled(false); } } }
public void setData(ArrayList<FinancingInfo> data,boolean isRefresh) { if (isRefresh){ mData.clear(); } mData.addAll(data); if (null == adapter) { manager = new linearlayoutmanager(getActivity()); mRec.addItemdecoration(new DividerGridItemdecoration(getActivity())); adapter = new Yearadapter(mData,getActivity()); mRec.setAdapter(adapter); mRec.setLayoutManager(manager); } else { adapter.notifyDataSetChanged(); } }
@Nullable @Override public View onCreateView(LayoutInflater inflater,@Nullable ViewGroup container,@Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_promociones,false); rvPromociones = (RecyclerView) view.findViewById(R.id.rv_promociones); textViewEmptyPromociones = (TextView) view.findViewById(R.id.textview_empty_promociones); linearlayoutmanager llm = new linearlayoutmanager(getContext()); adapter = new RVPromocionAdapter(getContext(),empresa.getPromociones(),empresa); rvPromociones.setLayoutManager(llm); rvPromociones.setAdapter(adapter); if (empresa.getPromociones().isEmpty()) { textViewEmptyPromociones.setVisibility(View.VISIBLE); } return view; }
@Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); this.context = getActivity(); list = new ArrayList<>(); recyclerViewAdapter = new FriendAdapter(getActivity(),list); /* recyclerViewAdapter.setClickListener(new FriendAdapter.ClickListener() { @Override public void onItemClickListener(View v,int pos) { gotoDetailsActivity(); } @Override public void onFriendListener(int pos,boolean isFollowing) { } });*/ recyclerView.setLayoutManager(new linearlayoutmanager(getActivity())); recyclerView.setAdapter(recyclerViewAdapter); getFollowing(); }
@Override public void update(Observable observable,Object o) { mBooks.clear(); if (o instanceof IBookProvider && ((IBookProvider)o).getBooks() != null) { mBooks.addAll(((IBookProvider)o).getBooks()); mAdapter.notifyDataSetChanged(); if (CurrentSelected.getBook() != null) { for (IBook book : mBooks) { if (book.getId().equalsIgnoreCase(CurrentSelected.getBook().getId())) { ((linearlayoutmanager)mRecyclerView.getLayoutManager()).scrollToPositionWithOffset(mBooks.indexOf(book),mRecyclerView.getHeight()/2); } } } } }
@Override protected void initView() { ButterKnife.bind(this); mToolbar.setNavigationIcon(R.drawable.icon_ab_back_material); mToolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { onBackpressed(); } }); mToolbar.setTitle(mModel.getTitle()); mCoordinatorLayout.setPadding(0,displayUtils.getStatusBarHeight(getResources()),0); mAdapter = new SimpleArticlelistadapter(this,null); mRecyclerView.setAdapter(mAdapter); mRecyclerView.setLayoutManager(new linearlayoutmanager(this)); mRecyclerView.addOnScrollListener(mScrollListener); setStatusBarStyle(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_recycler_view); mRecyclerView = (RecyclerView) findViewById(R.id.rv_pop); mRecyclerView.setLayoutManager(new linearlayoutmanager(this,false)); List<String> list = new ArrayList<>(); for (int i = 0; i < 10; i++) { list.add(""); } mPopAdapter = new RecyclerPopAdapter(); mPopAdapter.setNewData(list); mRecyclerView.setAdapter(mPopAdapter); initPop(); initEvents(); }
private void showBottomSheetList() { new QMUIBottomSheet.BottomListSheetBuilder(getActivity()) .addItem("水平方向") .addItem("垂直方向") .setonSheetItemClickListener(new QMUIBottomSheet.BottomListSheetBuilder.OnSheetItemClickListener() { @Override public void onClick(QMUIBottomSheet dialog,View itemView,int position,String tag) { dialog.dismiss(); switch (position) { case 0: mPagerLayoutManager.setorientation(linearlayoutmanager.HORIZONTAL); break; case 1: mPagerLayoutManager.setorientation(linearlayoutmanager.VERTICAL); break; default: break; } } }) .build() .show(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_open_license); ButterKnife.bind(this); initializetoolbar(); String[] libs = getResources().getStringArray(R.array.libraries); String[] licenses = getResources().getStringArray(R.array.licenses); List<OpenModel> list = new ArrayList<>(); OpenModel openModel; for (int i = 0; i < libs.length; i++) { openModel = new OpenModel(); openModel.setName(libs[i]); openModel.setLicense(licenses[i]); list.add(openModel); } mRecyclerView.setLayoutManager(new linearlayoutmanager(this)); mRecyclerView.setAdapter(new Licenselistadapter(list)); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.card_view_recycler_layout); top_bar_linear_back=(LinearLayout)this.findViewById(R.id.top_bar_linear_back); top_bar_linear_back.setonClickListener(new CustomOnClickListener()); top_bar_title=(TextView)this.findViewById(R.id.top_bar_title); top_bar_title.setText("CardView结合RecyclerView使用实例"); recycler_cardview=(RecyclerView)this.findViewById(R.id.recycler_cardview); linearlayoutmanager linearlayoutmanager=new linearlayoutmanager(this); linearlayoutmanager.setorientation(OrientationHelper.VERTICAL); recycler_cardview.setLayoutManager(linearlayoutmanager); recycler_cardview.setAdapter(new CardViewAdapter(this)); }
@Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); recyclerView.setHasFixedSize(true); linearlayoutmanager manager = new linearlayoutmanager(getContext()); manager.setorientation(linearlayoutmanager.HORIZONTAL); recyclerView.setLayoutManager(manager); recyclerView.setAdapter(adapter); UpdateMessages(); UpdateEvents(); //noinspection ConstantConditions typeface = Typeface.createFromAsset(getActivity().getAssets(),Constants.PathConstants.PRODUCT_SANS_FONT); notificationTitle.setTypeface(typeface); notificationMessage.setTypeface(typeface); notificationAuthorTime.setTypeface(typeface); }
@Override public View onCreateView(LayoutInflater inflater,Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_popular_grid,false); Context context = view.getContext(); RecyclerView gridTracksView = (RecyclerView) view.findViewById(R.id.gridLastFMTopTracks); mTracksAdapter = new TrackAdapter(getContext(),mListener); gridTracksView.setLayoutManager(new GridLayoutManager(context,mColumnCount,linearlayoutmanager.HORIZONTAL,false)); gridTracksView.setAdapter(mTracksAdapter); RecyclerView gridAlbumsView = (RecyclerView) view.findViewById(R.id.gridTopAlbums); mAlbumsAdapter = new AlbumAdapter(getContext(),mListener); gridAlbumsView.setLayoutManager(new GridLayoutManager(context,false)); gridAlbumsView.setAdapter(mAlbumsAdapter); return view; }
private int calculateRecyclerViewFirstPosition() { RecyclerView.LayoutManager manager = mRecyclerView.getLayoutManager(); if (manager instanceof StaggeredGridLayoutManager) { if (mVisiblePositions == null) mVisiblePositions = new int[((StaggeredGridLayoutManager) manager).getSpanCount()]; ((StaggeredGridLayoutManager) manager).findLastCompletelyVisibleItemPositions(mVisiblePositions); int max = -1; for (int pos : mVisiblePositions) { max = Math.max(max,pos); } return max; } else if (manager instanceof GridLayoutManager) { return ((GridLayoutManager) manager).findFirstCompletelyVisibleItemPosition(); } else { return ((linearlayoutmanager) manager).findLastCompletelyVisibleItemPosition(); } }
@Override protected void onCreate(@Nullable final Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_cursor_datasource_example); mCoordinatorLayout = (CoordinatorLayout) findViewById(R.id.coordinator); mAdapter = new CallsAdapter(); mRecyclerView = (RecyclerView) findViewById(android.R.id.list); mRecyclerView.setLayoutManager(new linearlayoutmanager(this)); mRecyclerView.setItemAnimator(new DefaultItemAnimator()); mRecyclerView.addItemdecoration(new DividerItemdecoration(this,DividerItemdecoration.VERTICAL)); mRecyclerView.setAdapter(mAdapter); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { if (ContextCompat.checkSelfPermission(this,CALL_LOG_PERMISSION) == PackageManager.PERMISSION_GRANTED) { onCallLogPermissionGranted(); } else { ActivityCompat.requestPermissions(this,CALL_LOG_PERMISSIONS,REQUEST_CODE_CALL_LOG_PERMISSION); } } else { onCallLogPermissionGranted(); } }
@Override public View onCreateView(@NonNull LayoutInflater inflater,@Nullable Bundle savedInstanceState) { getDialog().getwindow().requestFeature(Window.FEATURE_NO_TITLE); View root = inflater.inflate(R.layout.dialog_country_or_city_select,false); EditText input = root.findViewById(R.id.input); input.setText(filter); input.addTextChangedListener(new TextWatcherAdapter() { @Override public void afterTextChanged(Editable s) { filter = s.toString(); mHandler.removeCallbacks(runSearchRunnable); mHandler.postDelayed(runSearchRunnable,RUN_SEACRH_DELAY); } }); mRecyclerView = root.findViewById(R.id.list); mRecyclerView.setLayoutManager(new linearlayoutmanager(getActivity(),false)); return root; }
private void init() { inflate(getContext(),R.layout.view_news_widget,this); this.polsatNewsRecyclerView = (RecyclerView) findViewById(R.id.recycler_view_polsat_news); this.tvnNewsRecyclerView = (RecyclerView) findViewById(R.id.recycler_view_tvn_news); this.polsatNewsTitle = (TextView) findViewById(R.id.polsat_text); this.tvnNewsTitle = (TextView) findViewById(R.id.tvn_text); this.polsatNewsAdapter = new NewsRecyclerAdapter(getContext()); this.tvnNewsAdapter = new NewsRecyclerAdapter(getContext()); tvnNewsRecyclerView.setLayoutManager(new Scrollinglinearlayoutmanager(getContext(),false,5000)); tvnNewsRecyclerView.setAdapter(tvnNewsAdapter); polsatNewsRecyclerView.setAdapter(polsatNewsAdapter); polsatNewsRecyclerView.setLayoutManager(new Scrollinglinearlayoutmanager(getContext(),11000)); this.setVisibility(GONE); }
private int chooseDropTarget(RecyclerView rv,int dragPosition,int curY) { linearlayoutmanager layoutManager = ((linearlayoutmanager) rv.getLayoutManager()); int firstVisiblePosition = layoutManager.findFirstVisibleItemPosition(); if (mView.getY() < 0 && firstVisiblePosition == 0) { return firstVisiblePosition; } float referenceUp = mView.getY() - mView.getTranslationY(); if ((referenceUp > curY) && mView.getTranslationY() < 0) { if (referenceUp - curY > mView.getHeight()) { return dragPosition - 2; } if (referenceUp - curY < mView.getHeight() && referenceUp - curY > 0) { return dragPosition - 1; } } float referenceDown = mView.getY() - mView.getTranslationY() + mView.getHeight(); if ((referenceDown < curY) && mView.getTranslationY() > 0) { if (curY - referenceDown > mView.getHeight()) { return dragPosition + 2; } if (curY - referenceDown < mView.getHeight() && curY - referenceDown > 0) { return dragPosition + 1; } } return -1; }
@Override public int findTargetSnapPosition(RecyclerView.LayoutManager layoutManager,int veLocityX,int veLocityY) { int targetPos = super.findTargetSnapPosition(layoutManager,veLocityX,veLocityY); this.position = targetPos; final View currentView = findSnapView(layoutManager); if (targetPos != RecyclerView.NO_POSITION && currentView != null) { int currentPos = layoutManager.getPosition(currentView); int first = ((linearlayoutmanager) layoutManager).findFirstVisibleItemPosition(); int last = ((linearlayoutmanager) layoutManager).findLastVisibleItemPosition(); currentPos = targetPos < currentPos ? last : (targetPos > currentPos ? first : currentPos); targetPos = targetPos < currentPos ? currentPos - 1 : (targetPos > currentPos ? currentPos + 1 : currentPos); } return targetPos; }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); /* * Using findViewById,we get a reference to our RecyclerView from xml. This allows us to * do things like set the adapter of the RecyclerView and toggle the visibility. */ mNumbersList = (RecyclerView) findViewById(R.id.rv_numbers); /* * A linearlayoutmanager is responsible for measuring and positioning item views within a * RecyclerView into a linear list. This means that it can produce either a horizontal or * vertical list depending on which parameter you pass in to the linearlayoutmanager * constructor. By default,if you don't specify an orientation,you get a vertical list. * In our case,we want a vertical list,so we don't need to pass in an orientation flag to * the linearlayoutmanager constructor. * * There are other LayoutManagers available to display your data in uniform grids,* staggered grids,and more! See the developer documentation for more details. */ linearlayoutmanager layoutManager = new linearlayoutmanager(this); mNumbersList.setLayoutManager(layoutManager); /* * Use this setting to improve performance if you kNow that changes in content do not * change the child layout size in the RecyclerView */ mNumbersList.setHasFixedSize(true); /* * The GreenAdapter is responsible for displaying each item in the list. */ mAdapter = new GreenAdapter(NUM_LIST_ITEMS); mNumbersList.setAdapter(mAdapter); }
/** * 返回条目之间的间隔,例如我们想仿照ListView一样添加分割线,那么就需要设置outRect的下边距。 * @param outRect * @param view * @param parent * @param state */ @Override public void getItemOffsets(Rect outRect,View view,RecyclerView parent,RecyclerView.State state) { int position = parent.getChildAdapterPosition(view); int orientation = 0; int headerCount = 0,footerCount = 0; if (parent.getAdapter() instanceof XRecyclerViewAdapter){ headerCount = ((XRecyclerViewAdapter) parent.getAdapter()).getHeaderCount(); footerCount = ((XRecyclerViewAdapter) parent.getAdapter()).getFooterCount(); } RecyclerView.LayoutManager layoutManager = parent.getLayoutManager(); if (layoutManager instanceof StaggeredGridLayoutManager){ orientation = ((StaggeredGridLayoutManager) layoutManager).getorientation(); }else if (layoutManager instanceof GridLayoutManager){ orientation = ((GridLayoutManager) layoutManager).getorientation(); }else if (layoutManager instanceof linearlayoutmanager){ orientation = ((linearlayoutmanager) layoutManager).getorientation(); } if (position>=headerCount&&position<parent.getAdapter().getItemCount()-footerCount||mDrawheaderfooter){ if (orientation == OrientationHelper.VERTICAL){ outRect.bottom = mHeight; }else { outRect.right = mHeight; } } }
private void setupChatAdapter() { chatAdapter = new ChatAdapter(); linearlayoutmanager manager = new linearlayoutmanager(this); manager.setStackFromEnd(true); rvChat.setLayoutManager(manager); rvChat.setAdapter(chatAdapter); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.frm_venda_itens); ivenda = getIntent().getExtras().getInt("venda"); RecyclerView mRecyclerView = (RecyclerView) findViewById(R.id.rvItens); mRecyclerView.setLayoutManager(new linearlayoutmanager(frmvendaItens.this)); mRecyclerView.addItemdecoration(new SpacesItemdecoration(Funcoes.SPACE_BETWEEN_ITEMS)); mAdapter = new adpvendaItens(frmvendaItens.this,mRecyclerView,ivenda); mRecyclerView.setAdapter(mAdapter); ImageButton btnAdd = (ImageButton) findViewById(R.id.btnAdd); btnAdd.setonClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(frmvendaItens.this,frmManutencaovendaItens.class); intent.putExtra("Operacao","I"); intent.putExtra("venda",ivenda); startActivity(intent); } }); }
public void initSkuDetailBRAdapter() { skuDetailBRAdapter = new BRAdapter<CombinateQuoteInfo.SKUDetail>(this,R.layout.item_combination_product,combiSkuList) { @Override protected void convert(RvHolder holder,CombinateQuoteInfo.SKUDetail skuDetail,int position) { holder.setText(R.id.tv_proCtgName,skuDetail.getSkuCtgName()); holder.setText(R.id.tv_proNo,skuDetail.getSkuNo()); holder.setText(R.id.tv_proName,skuDetail.getSkuName()); holder.setText(R.id.tv_proPrice,skuDetail.getStdPrice()); holder.setText(R.id.tv_proQuantity,skuDetail.getSkuQuantity()); } }; yrvCombPro.setLayoutManager(new linearlayoutmanager(this)); yrvCombPro.setAdapter(skuDetailBRAdapter); }
private void initRecyclerView() { mData = new ArrayList<>(); mAdapter = new LifeAdapter(getContext(),mData,getActivity()); RecyclerView.LayoutManager layoutManager = new linearlayoutmanager(getContext(),false); mLifeRecyclerView.setLayoutManager(layoutManager); mLifeRecyclerView.setAdapter(mAdapter); }
/** * Start the dialog and display it on screen. The window is placed in the * application layer and opaque. Note that you should not override this * method to do initialization when the dialog is shown,instead implement * that in {@link #onStart}. */ public void show() { if (mRecyclerView.getLayoutManager() == null) { mRecyclerView.setLayoutManager(new linearlayoutmanager(getContext())); } if (mFastItemAdapter == null && mRecyclerView.getAdapter() == null) { mFastItemAdapter = new FastItemAdapter<>(); mRecyclerView.setAdapter(mFastItemAdapter); } super.show(); }
@Override public void initData() { query = new BmobQuery<>(); boolean isCache = query.hasCachedResult(Tools.class); if(isCache){ query.setCachePolicy(BmobQuery.CachePolicy.CACHE_ELSE_NETWORK); // 如果有缓存的话,则设置策略为CACHE_ELSE_NETWORK }else{ query.setCachePolicy(BmobQuery.CachePolicy.NETWORK_ELSE_CACHE); // 如果没有缓存的话,则设置策略为NETWORK_ELSE_CACHE } query.setMaxCacheAge(TimeUnit.DAYS.toMillis(3));//此表示缓存一天 query.setLimit(10); query.findobjects(new FindListener<Tools>() { @Override public void done(List<Tools> list,BmobException e) { if (e == null) { if (list.size() != 0) { toolsAdapter = new ToolsAdapter(getContext(),list); mRvTools.setLayoutManager(new linearlayoutmanager(getContext(),false)); mRvTools.setAdapter(toolsAdapter); } } } }); }
@Override public void onScrolled(RecyclerView recyclerView,int dx,int dy) { super.onScrolled(recyclerView,dx,dy); final linearlayoutmanager linearlayoutmanager = (linearlayoutmanager) recyclerView.getLayoutManager(); totalItemCount = linearlayoutmanager.getItemCount(); lastVisibleItem = linearlayoutmanager.findLastVisibleItemPosition(); if (!loading && totalItemCount <= (lastVisibleItem + visibleThreshold)) { // End has been reached // Do something loading = true; if (onLoadMoreListener != null) { onLoadMoreListener.onLoadMore(); } } // 여기까지 무한 스크롤 if (scrolleddistance > HIDE_THRESHOLD && controlsVisible) { onHide(); controlsVisible = false; scrolleddistance = 0; } else if (scrolleddistance < -HIDE_THRESHOLD && !controlsVisible) { onShow(); controlsVisible = true; scrolleddistance = 0; } if((controlsVisible && dy>0) || (!controlsVisible && dy<0)) { scrolleddistance += dy; } // 여기까지 툴바 숨기기 }
关于com.facebook.litho.widget.LinearLayoutInfo的实例源码和facebook源代码的问题就给大家分享到这里,感谢你花时间阅读本站内容,更多关于android.support.design.widget.CoordinatorLayout.LayoutParams的实例源码、android.support.v7.widget.LinearLayoutCompat.LayoutParams的实例源码、android.support.v7.widget.LinearLayoutCompat的实例源码、android.support.v7.widget.LinearLayoutManager的实例源码等相关知识的信息别忘了在本站进行查找喔。
本文标签: