Instead of the verbose setOnClickListener:
RxView.clicks(submitButton).subscribe(o -> log("submit button clicked!"));Observable
.just(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)| import android.graphics.Rect; | |
| import android.support.v7.widget.GridLayoutManager; | |
| import android.support.v7.widget.RecyclerView; | |
| import android.view.View; | |
| public class EqualSpacingItemDecoration extends RecyclerView.ItemDecoration { | |
| private final int spacing; | |
| private int displayMode; | |
| public static final int HORIZONTAL = 0; |
| <?xml version="1.0" encoding="utf-8"?> | |
| <!-- | |
| Copyright (C) 2015 The Android Open Source Project | |
| Licensed under the Apache License, Version 2.0 (the "License"); | |
| you may not use this file except in compliance with the License. | |
| You may obtain a copy of the License at | |
| http://www.apache.org/licenses/LICENSE-2.0 |
| put card.xml in your drawables directory, put colors.xml in your values directory or add the colors to your colors.xml file. | |
| set the background of a view to card, | |
| as you can see in card.xml the drawable handles the card margin, so you don't have to add a margin to your view | |
| ``` xml | |
| <View | |
| android:layout_width="fill_parent" |