我无法在Windows 10中安装带有节点版本6.3.0和npm版本3.10.3的TypeScript。低于错误
name.replace("Sam")
答案 0 :(得分:0)
对我来说,解决方案是在评论中设置Abhishek提到的注册表,但使用package kva.recyclerview;
import android.content.Context;
import android.graphics.Color;
import android.support.v7.widget.RecyclerView;
import android.text.Layout;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import java.util.ArrayList;
public class adapter extends RecyclerView.Adapter<adapter.MyViewHolder> {
Context context;
LayoutInflater inflater;
ArrayList<String> arrayList;
public adapter(Context context, ArrayList<String> arrayList) {
this.context = context;
this.arrayList = arrayList;
inflater = LayoutInflater.from(context);
}
@Override
public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = inflater.inflate(R.layout.lit_item, parent, false);
MyViewHolder holder = new MyViewHolder(view);
return holder;
}
@Override
public void onBindViewHolder(MyViewHolder holder, final int position) {
holder.tvphone.setText(arrayList.get(position));
holder.tvemail.setText(arrayList.get(position));
holder.tvname.setText(arrayList.get(position));
}
@Override
public int getItemCount() {
return arrayList.size();
}
public class MyViewHolder extends RecyclerView.ViewHolder {
TextView tvname;
TextView tvemail;
TextView tvphone;
public MyViewHolder(View itemView) {
super(itemView);
tvemail = (TextView) itemView.findViewById(R.id.emailtv);
tvname = (TextView) itemView.findViewById(R.id.nametv);
tvphone = (TextView) itemView.findViewById(R.id.phonetv);
}
}
}
所以:
public class MainActivity extends AppCompatActivity {
RecyclerView recyclerView;
adapter adapter;
View oldView=null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ArrayList<String> arrayList=new ArrayList<String>();
arrayList.add("aa");
arrayList.add("aa");
arrayList.add("aa");
arrayList.add("aa");
arrayList.add("aa");
arrayList.add("aa");
arrayList.add("aa");
arrayList.add("aa");
arrayList.add("aa");
arrayList.add("aa");
recyclerView=(RecyclerView)findViewById(R.id.recView);
adapter=new adapter(this,arrayList);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.setAdapter(adapter);
recyclerView.addOnItemTouchListener(
new RecyclerItemClickListener(this, recyclerView ,new RecyclerItemClickListener.OnItemClickListener() {
@Override public void onItemClick(View view, int position) {
view.setBackgroundColor(Color.BLUE);
}
@Override public void onLongItemClick(View view, int position) {
// do whatever
}
})
);
}
}
有关更多帮助和其他解决方案,请查看issue 8293 on npm Github repository