我有一个带安装程序应用程序的回收站视图,我想在顶部固定特定的应用程序,但我希望这些应用程序能够使用回收站视图滚动。
有点像经常使用的应用程序滚动与库存启动器上的应用程序抽屉。
但我无法在网上找到任何有关此内容的信息。有人能指出我正确的方向吗?
这是我当前的适配器,我目前正在使用listview但想切换到recyclerview
public class AppListAdapter extends ArrayAdapter<AppModel> {
private final LayoutInflater mLayoutInflater;
// Simple_list_item_2 contains a TwoLineListItem containing two TextViews.
public AppListAdapter(Context context) {
super(context, android.R.layout.simple_list_item_2);
mLayoutInflater = LayoutInflater.from(context);
}
public void setData(ArrayList<AppModel> appsList) {
clear();
if (appsList != null) {
addAll(appsList);
}
}
//If the platform version supports it add all items in one step, otherwise add in loop
@Override
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public void addAll(Collection<? extends AppModel> appsCollection) {
// If internal version of system is higher or equal to lollipop
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
super.addAll(appsCollection);
}else{
for(AppModel app: appsCollection){
super.add(app);
}
}
}
/**
* Put new apps items in the list.
*/
@Override public View getView(int position, View convertView, ViewGroup parent) {
View view;
if (convertView == null) {
view = mLayoutInflater.inflate(R.layout.list_item_icon_text, parent, false);
} else {
view = convertView;
}
AppModel item = getItem(position);
if (item.getIcon() == null) {
Log.d("Icon", " puste");
return null;
}
((ImageView) view.findViewById(R.id.icon)).setImageDrawable(item.getIcon());
((TextView) view.findViewById(R.id.text)).setText(item.getLabel());
return view;
}
}
与图片一样,我希望顶部的应用专用,然后是所有已安装的应用