我在我的项目中使用DataBindings和RecyclerView.我有RecyclerView的基础适配器.看起来像这样
public abstract class BaseAdapter<T extends ViewDataBinding> extends RecyclerView.Adapter<BaseAdapter.ViewHolder> {
public BaseAdapter() {}
public class ViewHolder extends RecyclerView.ViewHolder {
public T binding;
public ViewHolder(View view) {
super(view);
binding = DataBindingUtil.bind(view);
}
}
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
... code ...
}
}
Run Code Online (Sandbox Code Playgroud)
ViewHolder扩展类只有绑定字段类型不同.在扩展BaseAdapter类的实现之后:
public class BaseAdapterExtended extends BaseAdapter<BaseAdapterExtendedBinding> {
public BaseAdapterExtended(ArrayList<ItemModel> itemModels) {
super();
mData = itemModels;
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
LayoutInflater inflater = LayoutInflater.from(parent.getContext());
return new ViewHolder(BaseAdapterExtendedBinding.inflate(inflater, parent, false).getRoot());
}
@Override …Run Code Online (Sandbox Code Playgroud) 我正在使用ViewPager和TabLayout.如果选项卡可以放在显示选项卡上,则它们必须是:
app:tabMode="fixed"
Run Code Online (Sandbox Code Playgroud)
其他
app:tabMode="scrollable"
Run Code Online (Sandbox Code Playgroud)
我怎样才能做到这一点?
我尝试将转储从Android设备监视器转换为Eclipse内存分析器格式.我用下一个命令
hprof-conv dump.hprof converted-dump.hprof
Run Code Online (Sandbox Code Playgroud)
我得到错误
hprof-conv: command not found
Run Code Online (Sandbox Code Playgroud)
我在一个/platform-tools文件夹中这样做.当我在另一台计算机上运行相同的命令时,一切正常.问题是什么?
我对TabLayout有两个问题
1)我可以删除TabLayout突出显示或更改高亮颜色吗?
2)我可以为标签添加涟漪效果.每个选项卡都包含TextView我尝试添加这样的自定义背景
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="?android:colorControlHighlight">
<item android:drawable="@drawable/btn_white_bg" />
</ripple>
Run Code Online (Sandbox Code Playgroud)
但它不起作用.