我创建了一个添加了 public class MyAdapter extends RecyclerView.Adapter <RecyclerView.ViewHolder> {
private List<Sample> sampleList;
private Context mContext;
private static final int TYPE_HEADER = 0;
private static final int TYPE_ITEM = 1;
private Header header;
public MyAdapter (Header head, List<Sample> list) {
header = head;
sampleList= list;
}
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
mContext = parent.getContext();
View view;
if(viewType == TYPE_HEADER) {
view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_header, parent, false);
return new HeaderHolder(view);
} else if(viewType == TYPE_ITEM) {
view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_main, parent, false);
return new ItemHolder(view);
}
return null;
}
@Override
public void onBindViewHolder(final RecyclerView.ViewHolder holder, int position) {
if(holder instanceof HeaderHolder) {
HeaderHolder VHheader = (HeaderHolder)holder;
VHheader.txtTitle.setText(header.getHeader());
} else if(holder instanceof ItemHolder) {
((ItemHolder) holder).sample.setText("Sample Text "+ position );
}
}
@Override
public int getItemCount() {
return sampleList.size()+1;
}
@Override
public int getItemViewType(int position) {
if(isPositionHeader(position))
return TYPE_HEADER;
return TYPE_ITEM;
}
private boolean isPositionHeader(int position)
{
return position == 0;
}
private class ItemHolder extends RecyclerView.ViewHolder {
public TextView sample;
ItemHolder(View itemView) {
super(itemView);
sample= (TextView) itemView.findViewById(R.id.sampleText);
}
private class HeaderHolder extends RecyclerView.ViewHolder{
TextView txtTitle;
HeaderHolder(View itemView) {
super(itemView);
this.txtTitle = (TextView)itemView.findViewById(R.id.txtHeader);
}
}
插件的离子应用程序。
该应用在浏览器上工作正常(cordova-network-information
),绝对没有
问题。
在使用控制台日志执行实时重新加载(ionic serve
)时,它也正常工作。但有时候,它会将问题显示为ionic run android -l -c
,再次保存文件时,它运行正常,不会显示任何错误。
尝试构建.ipa并在Xcode上进行检查。 Xcode显示Reference Error : No connection defined
而没有其他内容。没有更多信息。
如果某人已经解决了这个问题并得到了解决方案。请帮忙。