MySQL
- 20 ответов
- 0 вопросов
9
Вклад в тег
SELECT f1, @i := @i + 1
FROM table1
JOIN (SELECT @i := 0) t
SELECT f1, f2
FROM
(
SELECT f1, f2, @i := @i + 1 AS num
FROM table1
JOIN (SELECT @i := 0) t
ORDER BY f3
) sel
WHERE sel.num % 5 = 0
<android.support.v4.widget.DrawerLayout
...
>
<android.support.design.widget.NavigationView
...
>
<
...
Тут вставляете все, что вашей душе угодно. Хоть фрагмент, хоть еще чего.
...
/>
</android.support.design.widget.NavigationView>
</android.support.v4.widget.DrawerLayout>
public abstract class AbstractRecyclerAdapter<E> extends
RecyclerView.Adapter<AbstractRecyclerAdapter.BindingHolder> {
private List<E> mElements;
public AbstractRecyclerAdapter() {
mElements = new ArrayList<>();
}
public abstract int getItemLayoutId();
public abstract int getVariableId();
public void setElements(List<E> elements) {
mElements = elements;
}
@Override
public BindingHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View v = LayoutInflater.from(parent.getContext()).inflate(getItemLayoutId(),
parent, false);
return new BindingHolder(v);
}
@Override
public void onBindViewHolder(BindingHolder holder, int position) {
final E element = mElements.get(position);
holder.getBinding().setVariable(getVariableId(), element);
holder.getBinding().executePendingBindings();
}
@Override
public int getItemCount() {
return mElements.size();
}
public static class BindingHolder extends RecyclerView.ViewHolder {
private ViewDataBinding binding;
public BindingHolder(View itemView) {
super(itemView);
binding = DataBindingUtil.bind(itemView);
}
public ViewDataBinding getBinding() {
return binding;
}
}
}
public class HistoryRecyclerAdapter<History> extends AbstractRecyclerAdapter<History> {
public HistoryRecyclerAdapter() {
super();
}
@Override
public int getItemLayoutId() {
return R.layout.item_history;
}
@Override
public int getVariableId() {
return BR.history;
}
}
mRecyclerAdapter.setElements(getData());
mRecyclerView.setAdapter(mRecyclerAdapter);
mRecyclerAdapter.notifyDataSetChanged();
...
<data>
...
<variable
name="history "
type="History " />
...
</data>
...