android.widget.GridLayout Java Examples
The following examples show how to use
android.widget.GridLayout.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ColorPreference.java From Noyze with Apache License 2.0 | 6 votes |
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { LayoutInflater layoutInflater = LayoutInflater.from(getActivity()); mRootView = (ViewGroup) layoutInflater.inflate(R.layout.dialog_colors, null); mAlphaSeekBar = (SeekBar) mRootView.findViewById(android.R.id.progress); mAlphaSeekBar.setOnSeekBarChangeListener(alphaSeekListener); mAlphaSeekBar.setMax(255); mAlphaSeekBar.setProgress(getValueAlpha(false)); mColorGrid = (GridLayout) mRootView.findViewById(R.id.color_grid); mColorGrid.setColumnCount(mPreference.mNumColumns); repopulateItems(); return new AlertDialog.Builder(getActivity()) .setView(mRootView) .setNegativeButton(android.R.string.cancel, clickListener) .setPositiveButton(android.R.string.ok, clickListener) .create(); }
Example #2
Source File: SortingActivity.java From Primary with GNU General Public License v3.0 | 6 votes |
@Override protected void onResume() { super.onResume(); GridLayout sortArea = findViewById(R.id.sort_area); if (isLandscape()) { numcolumns = 6; } else { numcolumns = 3; } sortArea.setColumnCount(numcolumns); //override super class LinearLayout centercol = findViewById(R.id.centercol); centercol.setOrientation(LinearLayout.VERTICAL); findViewById(R.id.score_total_correct_area).setVisibility(View.GONE); findViewById(R.id.score_level_percent_area).setVisibility(View.GONE); }
Example #3
Source File: BrowserWeiboMsgFragment.java From iBeebo with GNU General Public License v3.0 | 6 votes |
private void initView(View view, Bundle savedInstanceState) { layout = new BrowserWeiboMsgLayout(); layout.username = (TextView) view.findViewById(R.id.username); layout.content = (TextView) view.findViewById(R.id.content); layout.recontent = (TextView) view.findViewById(R.id.repost_content); layout.time = (TextView) view.findViewById(R.id.time); layout.location = (TextView) view.findViewById(R.id.location); layout.source = (TextView) view.findViewById(R.id.source); layout.mapView = (ImageView) view.findViewById(R.id.map); layout.comment_count = (TextView) view.findViewById(R.id.comment_count); layout.repost_count = (TextView) view.findViewById(R.id.repost_count); layout.count_layout = view.findViewById(R.id.count_layout); layout.avatar = (ProfileTopAvatarImageView) view.findViewById(R.id.avatar); layout.content_pic = (WeiboDetailImageView) view.findViewById(R.id.content_pic); layout.content_pic_multi = (GridLayout) view.findViewById(R.id.content_pic_multi); layout.repost_pic = (WeiboDetailImageView) view.findViewById(R.id.repost_content_pic); layout.repost_pic_multi = (GridLayout) view.findViewById(R.id.repost_content_pic_multi); layout.repost_layout = (LinearLayout) view.findViewById(R.id.repost_layout); }
Example #4
Source File: SaveLoadStateFragment.java From citra_android with GNU General Public License v3.0 | 6 votes |
@Nullable @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_saveload_state, container, false); GridLayout grid = rootView.findViewById(R.id.grid_state_slots); for (int childIndex = 0; childIndex < grid.getChildCount(); childIndex++) { Button button = (Button) grid.getChildAt(childIndex); button.setOnClickListener(this); } // So that item clicked to start this Fragment is no longer the focused item. grid.requestFocus(); return rootView; }
Example #5
Source File: MainActivity.java From Beginner-Level-Android-Studio-Apps with GNU General Public License v3.0 | 6 votes |
public void load(){ saved = this.getSharedPreferences("com.ahmedmaghawry.ahmedezzat2048", Context.MODE_PRIVATE); highName = saved.getString("Name", ""); highScore = saved.getInt("Score", 0); TextView highna = (TextView) findViewById(R.id.bestName); TextView highnu = (TextView) findViewById(R.id.bestScore); highna.setText(highName + ""); highnu.setText(highScore + ""); for (int i = 0; i < 16; i++) { board.add(""); } int first_index = rand.nextInt(16); board.set(first_index, "2"); GridLayout grid = (GridLayout) findViewById(R.id.grid); TextView te = (TextView) grid.getChildAt(first_index); te.setText("2"); drawit(); }
Example #6
Source File: PaymentRequestSection.java From AndroidChromium with Apache License 2.0 | 6 votes |
@Override protected void createMainSectionContent(LinearLayout mainSectionLayout) { Context context = mainSectionLayout.getContext(); // Add a label that will be used to indicate that the total cart price has been updated. addUpdateText(mainSectionLayout); // The breakdown is represented by an end-aligned GridLayout that takes up only as much // space as it needs. The GridLayout ensures a consistent margin between the columns. mBreakdownLayout = new GridLayout(context); mBreakdownLayout.setColumnCount(2); LayoutParams breakdownParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); breakdownParams.gravity = Gravity.END; mainSectionLayout.addView(mBreakdownLayout, breakdownParams); }
Example #7
Source File: PaymentRequestSection.java From delion with Apache License 2.0 | 6 votes |
private View createIcon(GridLayout parent, int rowIndex) { // The icon has a pre-defined width. ImageView icon = new ImageView(parent.getContext()); icon.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO); icon.setBackgroundResource(R.drawable.payments_ui_logo_bg); icon.setImageResource(mOption.getDrawableIconId()); icon.setMaxWidth(mIconMaxWidth); // The icon floats to the right of everything. GridLayout.LayoutParams iconParams = new GridLayout.LayoutParams( GridLayout.spec(rowIndex, 1, GridLayout.CENTER), GridLayout.spec(2, 1)); iconParams.topMargin = mVerticalMargin; ApiCompatibilityUtils.setMarginStart(iconParams, mLargeSpacing); parent.addView(icon, iconParams); icon.setOnClickListener(OptionSection.this); return icon; }
Example #8
Source File: PaymentRequestSection.java From AndroidChromium with Apache License 2.0 | 6 votes |
private View createOptionIcon(GridLayout parent, int rowIndex, boolean editIconExists) { // The icon has a pre-defined width. ImageView optionIcon = new ImageView(parent.getContext()); optionIcon.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO); optionIcon.setBackgroundResource(R.drawable.payments_ui_logo_bg); optionIcon.setImageDrawable(mOption.getDrawableIcon()); optionIcon.setMaxWidth(mIconMaxWidth); // Place option icon at column three if no edit icon. int columnStart = editIconExists ? 2 : 3; GridLayout.LayoutParams iconParams = new GridLayout.LayoutParams( GridLayout.spec(rowIndex, 1, GridLayout.CENTER), GridLayout.spec(columnStart, 1)); iconParams.topMargin = mVerticalMargin; parent.addView(optionIcon, iconParams); optionIcon.setOnClickListener(OptionSection.this); return optionIcon; }
Example #9
Source File: QuickRow.java From LaunchTime with GNU General Public License v3.0 | 6 votes |
public void repopulate() { final List<ComponentName> quickRowOrder = db().getAppCategoryOrder(QUICK_ROW_CAT); mQuickRow.postDelayed(new Runnable() { @Override public void run() { mQuickRow.removeAllViews(); for (ComponentName actvname : quickRowOrder) { AppLauncher app = db().getApp(actvname); if (!appAlreadyHere(app)) { ViewGroup item = mMainActivity.getLauncherView(app, true); if (item != null) { GridLayout.LayoutParams lp = new GridLayout.LayoutParams(); lp.columnSpec = GridLayout.spec(GridLayout.UNDEFINED, GridLayout.TOP); mQuickRow.addView(item, lp); } } } } }, 400); }
Example #10
Source File: MainViewer.java From GNSS_Compare with Apache License 2.0 | 6 votes |
private void initializeTextView( TextView view, GridLayout layout, int columnId){ layout.addView(view); GridLayout.LayoutParams param = new GridLayout.LayoutParams(); param.height = GridLayout.LayoutParams.WRAP_CONTENT; param.width = GridLayout.LayoutParams.WRAP_CONTENT; param.rightMargin = 5; param.topMargin = 5; view.setTextSize(11); view.setWidth(TEXT_FIELD_WIDTH[columnId]); view.setTextAlignment(View.TEXT_ALIGNMENT_CENTER); param.setGravity(Gravity.CENTER); param.columnSpec = GridLayout.spec(columnId); param.rowSpec = GridLayout.spec(rowId); view.setLayoutParams (param); }
Example #11
Source File: MainViewer.java From GNSS_Compare with Apache License 2.0 | 6 votes |
@Override public void reinitializeViews(GridLayout gridLayout){ if(getActivity() != null) { removeFromGrid(gridLayout); nameView = new TextView(getActivity()); latView = new TextView(getActivity()); lonView = new TextView(getActivity()); altView = new TextView(getActivity()); clockBiasView = new TextView(getActivity()); initializeTextView(nameView, gridLayout, POSE_NAME_COLUMN); initializeTextView(latView, gridLayout, POSE_LAT_COLUMN); initializeTextView(lonView, gridLayout, POSE_LON_COLUMN); initializeTextView(altView, gridLayout, POSE_ALT_COLUMN); initializeTextView(clockBiasView, gridLayout, POSE_CLOCK_BIAS_COLUMN); } }
Example #12
Source File: MainActivity.java From CourseScheduleDemo with MIT License | 6 votes |
private void setUpClsTitle(){ for (int i=0; i<TITLE_DATA.length; ++i){ String content = TITLE_DATA[i]; GridLayout.LayoutParams params = new GridLayout.LayoutParams(); //第一列的时候 if (i == 0){ params.width = mTableDistance; } else { //添加分割线 View divider = getLayoutInflater().inflate(R.layout.grid_title_form,mGlClsTitle,false); mGlClsTitle.addView(divider); params.width = mTableDistance * 2; } params.height = GridLayout.LayoutParams.MATCH_PARENT; TextView textView = new TextView(this); textView.setTextColor(getResources().getColor(R.color.blue)); textView.setText(content); textView.setGravity(Gravity.CENTER); mGlClsTitle.addView(textView,params); } }
Example #13
Source File: CastFragment.java From Kore with Apache License 2.0 | 6 votes |
@Override public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) { if (! cursor.moveToFirst()) { return; } ArrayList<VideoType.Cast> castArrayList; int id = getArguments().getInt(BUNDLE_LOADER_TYPE); if (id == TYPE.MOVIE.ordinal()) { castArrayList = createMovieCastList(cursor); } else { castArrayList = createTVShowCastList(cursor); } UIUtils.setupCastInfo(getActivity(), castArrayList, (GridLayout) getView().findViewById(R.id.cast_list), AllCastActivity.buildLaunchIntent(getActivity(), getArguments().getString(BUNDLE_TITLE), castArrayList)); }
Example #14
Source File: SetupWizardTicTacToeController.java From talkback with Apache License 2.0 | 6 votes |
/** * Constructor that allows a custom computer move generator to be supplied. * * @param context Current application context * @param gameBoard GridLayout containing the buttons that make up the tic-tac-toe board * @param resetButton Button to reset the board to a new game * @param computerMoveGenerator Custom computer move generator for this game */ public SetupWizardTicTacToeController( Context context, GridLayout gameBoard, Button resetButton, TicTacToeComputerMoveGenerator computerMoveGenerator) { this.context = context; this.gameBoard = gameBoard; emptySpacesIndices = new ArrayList<>(); this.computerMoveGenerator = computerMoveGenerator; this.resetButton = resetButton; this.resetButton.setOnClickListener(view -> resetGameBoard()); resetGameBoard(); }
Example #15
Source File: ColorPreference.java From Noyze with Apache License 2.0 | 6 votes |
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { LayoutInflater layoutInflater = LayoutInflater.from(getActivity()); mRootView = (ViewGroup) layoutInflater.inflate(R.layout.dialog_colors, null); mAlphaSeekBar = (SeekBar) mRootView.findViewById(android.R.id.progress); mAlphaSeekBar.setOnSeekBarChangeListener(alphaSeekListener); mAlphaSeekBar.setMax(255); mAlphaSeekBar.setProgress(getValueAlpha(false)); mColorGrid = (GridLayout) mRootView.findViewById(R.id.color_grid); mColorGrid.setColumnCount(mPreference.mNumColumns); repopulateItems(); return new AlertDialog.Builder(getActivity()) .setView(mRootView) .setNegativeButton(android.R.string.cancel, clickListener) .setPositiveButton(android.R.string.ok, clickListener) .create(); }
Example #16
Source File: MainViewer.java From GNSS_Compare with Apache License 2.0 | 6 votes |
/** * Factory method to initialize each text view and add it to the layout * @param view text view to be initialized * @param layout layout to which the view is to be added * @param columnId column of the layout to which the view is to be added */ private void initializeTextView( TextView view, GridLayout layout, int columnId){ layout.addView(view); GridLayout.LayoutParams param = new GridLayout.LayoutParams(); param.height = GridLayout.LayoutParams.WRAP_CONTENT; param.width = GridLayout.LayoutParams.WRAP_CONTENT; param.rightMargin = 5; param.topMargin = 5; view.setTextSize(11); view.setWidth(TEXT_FIELD_WIDTH[columnId]); view.setTextAlignment(View.TEXT_ALIGNMENT_CENTER); param.setGravity(Gravity.CENTER); param.columnSpec = GridLayout.spec(columnId); param.rowSpec = GridLayout.spec(rowId); view.setLayoutParams (param); }
Example #17
Source File: MainViewer.java From GNSS_Compare with Apache License 2.0 | 6 votes |
public void reinitializeViews(GridLayout gridLayout) { if(getActivity() != null) { removeFromGrid(gridLayout); nameView = new TextView(getActivity()); visibleView = new TextView(getActivity()); usedView = new TextView(getActivity()); initializeTextView(nameView, gridLayout, POSE_NAME_COLUMN); initializeTextView(visibleView, gridLayout, POSE_VISIBLE_COLUMN); initializeTextView(usedView, gridLayout, POSE_USED_COLUMN); initializeViewsAsEmpty(); } }
Example #18
Source File: BrowserWeiboMsgFragment.java From iBeebo with GNU General Public License v3.0 | 6 votes |
private void initView(View view, Bundle savedInstanceState) { layout = new BrowserWeiboMsgLayout(); layout.username = (TextView) view.findViewById(R.id.username); layout.content = (TextView) view.findViewById(R.id.content); layout.recontent = (TextView) view.findViewById(R.id.repost_content); layout.time = (TextView) view.findViewById(R.id.time); layout.location = (TextView) view.findViewById(R.id.location); layout.source = (TextView) view.findViewById(R.id.source); layout.mapView = (ImageView) view.findViewById(R.id.map); layout.comment_count = (TextView) view.findViewById(R.id.comment_count); layout.repost_count = (TextView) view.findViewById(R.id.repost_count); layout.count_layout = view.findViewById(R.id.count_layout); layout.avatar = (ProfileTopAvatarImageView) view.findViewById(R.id.avatar); layout.content_pic = (WeiboDetailImageView) view.findViewById(R.id.content_pic); layout.content_pic_multi = (GridLayout) view.findViewById(R.id.content_pic_multi); layout.repost_pic = (WeiboDetailImageView) view.findViewById(R.id.repost_content_pic); layout.repost_pic_multi = (GridLayout) view.findViewById(R.id.repost_content_pic_multi); layout.repost_layout = (LinearLayout) view.findViewById(R.id.repost_layout); }
Example #19
Source File: ScoresActivity.java From Primary with GNU General Public License v3.0 | 5 votes |
private void addTextView(GridLayout viewg, String text, float fsize, int lpadding) { TextView tview = new TextView(this); tview.setTextSize(fsize); tview.setPadding(lpadding + 16, 6, 6, 6); tview.setText(text); viewg.addView(tview); }
Example #20
Source File: NotificationPeekActivity.java From NotificationPeekPort with Apache License 2.0 | 5 votes |
/** * Update small notification icons when there is new notification coming, and the * Activity is in foreground. */ private void updateNotificationIcons() { if (mNotificationsContainer.getVisibility() != View.VISIBLE) { mNotificationsContainer.setVisibility(View.VISIBLE); } NotificationHub notificationHub = NotificationHub.getInstance(); int iconSize = getResources().getDimensionPixelSize(R.dimen.small_notification_icon_size); int padding = getResources().getDimensionPixelSize(R.dimen.small_notification_icon_padding); final StatusBarNotification n = notificationHub.getCurrentNotification(); ImageView icon = new ImageView(this); icon.setAlpha(NotificationPeek.ICON_LOW_OPACITY); icon.setPadding(padding, 0, padding, 0); icon.setImageDrawable(NotificationPeekViewUtils.getIconFromResource(this, n)); icon.setTag(n); restoreFirstIconVisibility(); int oldIndex = getOldIconViewIndex(notificationHub); if (oldIndex >= 0) { mNotificationsContainer.removeViewAt(oldIndex); } mNotificationsContainer.addView(icon); LinearLayout.LayoutParams linearLayoutParams = new LinearLayout.LayoutParams(iconSize, iconSize); // Wrap LayoutParams to GridLayout.LayoutParams. GridLayout.LayoutParams gridLayoutParams = new GridLayout.LayoutParams(linearLayoutParams); icon.setLayoutParams(gridLayoutParams); }
Example #21
Source File: TGABitmapViewerActivity.java From TGAReader with MIT License | 5 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); GridLayout layout = new GridLayout(this); ScrollView scroll = new ScrollView(this); scroll.addView(layout); setContentView(scroll); try { String [] list = getAssets().list("images"); // count tga images int count = 0; for(int i=0; i<list.length; i++) { if(list[i].endsWith(".tga")) count++; } layout.setColumnCount(3); layout.setRowCount(count/3); // create tga image view for(int i=0; i<list.length; i++) { if(list[i].endsWith(".tga")) { LinearLayout view = createTGAView(list[i]); if(view != null) layout.addView(view); } } } catch (IOException e) { e.printStackTrace(); } }
Example #22
Source File: PaymentRequestSection.java From AndroidChromium with Apache License 2.0 | 5 votes |
@Override protected void createMainSectionContent(LinearLayout mainSectionLayout) { Context context = mainSectionLayout.getContext(); mCheckingProgress = createLoadingSpinner(); mOptionLayout = new GridLayout(context); mOptionLayout.setColumnCount(4); mainSectionLayout.addView(mOptionLayout, new LinearLayout.LayoutParams( LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); }
Example #23
Source File: PaymentRequestSection.java From AndroidChromium with Apache License 2.0 | 5 votes |
private View createEditIcon(GridLayout parent, int rowIndex) { View editorIcon = LayoutInflater.from(parent.getContext()) .inflate(R.layout.payment_option_edit_icon, null); // The icon floats to the right of everything. GridLayout.LayoutParams iconParams = new GridLayout.LayoutParams( GridLayout.spec(rowIndex, 1, GridLayout.CENTER), GridLayout.spec(3, 1)); iconParams.topMargin = mVerticalMargin; parent.addView(editorIcon, iconParams); editorIcon.setOnClickListener(OptionSection.this); return editorIcon; }
Example #24
Source File: PaymentRequestSection.java From AndroidChromium with Apache License 2.0 | 5 votes |
public OptionRow(GridLayout parent, int rowIndex, int rowType, PaymentOption item, boolean isSelected) { boolean optionIconExists = item != null && item.getDrawableIcon() != null; boolean editIconExists = item != null && item.isEditable() && isSelected; boolean isEnabled = item != null && item.isValid(); mRowType = rowType; mOption = item; mButton = createButton(parent, rowIndex, isSelected, isEnabled); mLabel = createLabel(parent, rowIndex, optionIconExists, editIconExists, isEnabled); mOptionIcon = optionIconExists ? createOptionIcon(parent, rowIndex, editIconExists) : null; mEditIcon = editIconExists ? createEditIcon(parent, rowIndex) : null; }
Example #25
Source File: StdGameActivity.java From Primary with GNU General Public License v3.0 | 5 votes |
private void setColumnCount(GridLayout answerarea, int count) { List<View> kids = new ArrayList<>(); for(int i = 0; i< answerarea.getChildCount(); i++) { kids.add(answerarea.getChildAt(i)); } answerarea.removeAllViews(); answerarea.setColumnCount(count); for (View k: kids) { k.setLayoutParams(new GridLayout.LayoutParams()); answerarea.addView(k); } }
Example #26
Source File: StdGameActivity.java From Primary with GNU General Public License v3.0 | 5 votes |
@Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); GridLayout answerarea = findViewById(R.id.answer_area); LinearLayout centercol = findViewById(R.id.centercol); ActionBar actionBar = getSupportActionBar(); if (isLandscape()) { //answerarea.setOrientation(GridLayout.VERTICAL); setColumnCount(answerarea,2); centercol.setOrientation(LinearLayout.HORIZONTAL); if (actionBar != null) { actionBar.hide(); } } else { //answerarea.setOrientation(GridLayout.VERTICAL); setColumnCount(answerarea,1); centercol.setOrientation(LinearLayout.VERTICAL); if (actionBar != null) { actionBar.show(); } } }
Example #27
Source File: PaymentRequestSection.java From delion with Apache License 2.0 | 5 votes |
@Override protected void createMainSectionContent(LinearLayout mainSectionLayout) { Context context = mainSectionLayout.getContext(); mCheckingProgress = createLoadingSpinner(); mOptionLayout = new GridLayout(context); mOptionLayout.setColumnCount(3); mainSectionLayout.addView(mOptionLayout, new LinearLayout.LayoutParams( LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); }
Example #28
Source File: PaymentRequestSection.java From delion with Apache License 2.0 | 5 votes |
public OptionRow(GridLayout parent, int rowIndex, int rowType, PaymentOption item, boolean isSelected) { boolean iconExists = item != null && item.getDrawableIconId() != 0; boolean isEnabled = item != null && item.isValid(); mRowType = rowType; mOption = item; mButton = createButton(parent, rowIndex, isSelected, isEnabled); mLabel = createLabel(parent, rowIndex, iconExists, isEnabled); mIcon = iconExists ? createIcon(parent, rowIndex) : null; }
Example #29
Source File: FeedbackLevelLayout.java From ssj with GNU General Public License v3.0 | 5 votes |
public FeedbackLevelLayout(FeedbackCollectionActivity feedbackCollectionActivity, int level, final Map<Feedback, FeedbackCollection.LevelBehaviour> feedbackLevelBehaviourMap) { super(feedbackCollectionActivity); LinearLayout.inflate(feedbackCollectionActivity, R.layout.single_level_layout, this); levelTextView = (TextView) this.findViewById(R.id.levelText); feedbackComponentGrid = (android.widget.GridLayout) this.findViewById(R.id.feedbackComponentGrid); setLevel(level); relayoutGrid(feedbackCollectionActivity, feedbackLevelBehaviourMap); }
Example #30
Source File: BrickDataManager.java From brickkit-android with Apache License 2.0 | 5 votes |
/** * Set the recycler view for this BrickDataManager, this will setup the underlying adapter and begin displaying any bricks. * * @param context {@link Context} to use * @param recyclerView {@link RecyclerView} to put views in * @param orientation Layout orientation. Should be {@link GridLayoutManager#HORIZONTAL} or {@link GridLayoutManager#VERTICAL}. * @param reverse When set to true, layouts from end to start. * @param recyclerViewParent View RecyclerView's parent view */ public void setRecyclerView(Context context, RecyclerView recyclerView, int orientation, boolean reverse, View recyclerViewParent) { this.context = context; this.brickRecyclerAdapter = new BrickRecyclerAdapter(this, recyclerView); this.vertical = orientation == GridLayout.VERTICAL; this.recyclerViewParent = recyclerViewParent; this.recyclerView = recyclerView; this.recyclerView.setAdapter(brickRecyclerAdapter); if (itemDecoration != null) { this.recyclerView.removeItemDecoration(itemDecoration); } this.itemDecoration = new BrickRecyclerItemDecoration(this); this.recyclerView.addItemDecoration(itemDecoration); this.recyclerView.setItemAnimator(new AvoidFlickerItemAnimator()); applyGridLayout(orientation, reverse); for (BrickBehavior behavior : behaviors) { behavior.attachToRecyclerView(recyclerView); } LinkedList<BaseBrick> items = getRecyclerViewItems(); int itemCount = items.size(); if (itemCount > 0) { computePaddingPosition(items.get(0)); brickRecyclerAdapter.notifyItemRangeInserted(0, itemCount); } }