Recyclerview嵌套recyclerview的深坑,我坐在Recyclerview这个坑里很久了,仰望天空希望能把我拉上去。

Recyclerview嵌套recyclerview的深坑,对于一个新手来说怎么也上不去,特来邀请键盘中的高手高高手,拉拉我;

第一个Recyclerview布局:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/area_LinearLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:focusable="true"
    android:focusableInTouchMode="true"
    android:orientation="vertical">

    <LinearLayout

        android:layout_width="match_parent"
        android:layout_height="40dp"
        android:background="@drawable/drawable_black_one"
        android:orientation="horizontal"
        android:layout_margin="3dp">
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="5dp"
            android:layout_gravity="center"
            android:text=""
            android:textColor="@drawable/drawable_white_pure"
            android:lines="1"
            android:layout_weight="1"/>


        <TextView
            android:layout_width="1dp"
            android:layout_height="30dp"
            android:layout_gravity="center"
            android:layout_margin="5dp"
            android:background="@color/whiteness"

             />

        <TextView
            android:id="@+id/peers_location_TextView"
            android:layout_width="70dp"
            android:layout_height="40dp"
            android:layout_marginLeft="5sp"
            android:layout_marginRight="10dp"
            android:ellipsize="end"
            android:gravity="center"
            android:text=""
            android:textColor="@color/whiteness"
            android:textSize="14sp"
            android:lines="1"
            android:textStyle="bold" />
    </LinearLayout>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="3dp"
        >
        <RelativeLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            >


            <ImageView
                android:layout_width="20dp"
                android:layout_height="20dp"
                android:layout_alignParentTop="true"
                android:layout_alignParentEnd="true"
                android:layout_marginTop="0dp"
                android:layout_marginEnd="10dp"
                android:scaleType="fitStart"
                android:src="@drawable/location" />
        </RelativeLayout>

    </LinearLayout>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="40dp"
        android:background="@drawable/drawable_black_one"
        android:layout_gravity="center"
        android:focusable="true"
        android:focusableInTouchMode="true"
        android:layout_margin="3dp">

        <EditText
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_margin="1dp"
            android:background="@color/text_white"
            android:hint="行业人员"
            android:textSize="13dp"
            android:gravity="center"
            android:lines="1"
            android:layout_weight="1"/>
        <TextView
            android:layout_width="50dp"
            android:layout_height="wrap_content"
            android:text="搜索"
            android:textSize="14dp"
            android:layout_marginLeft="14dp"
            android:layout_gravity="center"
            android:textColor="@color/whiteness"
            android:layout_margin="5dp"
            android:gravity="center"/>
    </LinearLayout>
    <android.support.v7.widget.RecyclerView
        android:id="@+id/user_info_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
         />
</LinearLayout>

在第一个Recycleview的item里面嵌套了第二个Recyclerview不知道这样对不对?

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <LinearLayout
            android:id="@+id/portrait"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal">

            <ImageView
                android:id="@+id/user_portrait"
                android:layout_width="50dp"
                android:layout_height="50dp"
                android:layout_margin="5dp"
                android:src="@drawable/em_default_avatar" />

            <LinearLayout
                android:layout_width="fill_parent"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:orientation="vertical">


                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="20dp"
                    android:layout_marginTop="5dp"
                    android:gravity="clip_horizontal">

                    <TextView
                        android:id="@+id/user_industry"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center"
                        android:background="@drawable/dialog_circular_whiteness"
                        android:ellipsize="end"
                        android:gravity="center"
                        android:text="建筑"
                        android:textColor="@color/colorPrimary"
                        android:textSize="14sp"
                        android:textStyle="bold" />

                    <TextView
                        android:id="@+id/user_name"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="bottom"
                        android:layout_marginLeft="5dp"
                        android:background="@drawable/dialog_circular_whiteness"
                        android:ellipsize="end"
                        android:gravity="center"
                        android:text="努力改变自己"
                        android:textColor="#323232"
                        android:textSize="10sp"
                        android:textStyle="bold" />

                    <TextView
                        android:id="@+id/name_voip"
                        android:layout_width="20dp"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center"
                        android:ellipsize="end"
                        android:gravity="center"
                        android:text="voip"
                        android:textColor="@color/text_pink"
                        android:textSize="7sp" />

                </LinearLayout>

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="35dp">

                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:text="努力改变自己"
                        android:textSize="12dp" />
                </LinearLayout>

            </LinearLayout>

            <RelativeLayout
                android:layout_width="60dp"
                android:layout_height="match_parent"
                android:gravity="center">

                <TextView
                    android:id="@+id/user_location"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="20dp"
                    android:background="@drawable/dialog_circular_whiteness"
                    android:text=""
                    android:textSize="12dp"
                    android:textStyle="bold" />
            </RelativeLayout>

        </LinearLayout>


    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1">

                **<!-- 导入RecyclerView-->**
                <android.support.v7.widget.RecyclerView
                    android:id="@+id/user_peesr_info"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    />
            </LinearLayout>

            <LinearLayout
                android:layout_width="fill_parent"
                android:layout_height="10dp">

                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:gravity="right"
                    android:text="访问:10000人"
                    android:textSize="8dp" />
            </LinearLayout>
        </LinearLayout>

    </LinearLayout>

第一个Recyclerview的适配器:

public class Home_RecyclerView_Adapter extends RecyclerView.Adapter<Home_RecyclerView_Adapter.myViewHodler> {
    private Context context;
    private LinkedList<Home_list_get_set> LinkedList;
    public LinkedList<User_Recruitment_get_set> mLinkedList;
    public Home_list_get_set mHome_list_get_set;


    //创建构造函数
    public Home_RecyclerView_Adapter(Context context, LinkedList<Home_list_get_set> industrytitlegetsetList) {
        //将传递过来的数据,赋值给本地变量
        this.context = context;//上下文
        this.LinkedList = industrytitlegetsetList;//实体类数据ArrayList
    }

    /**
     * 创建viewhodler,相当于listview中getview中的创建view和viewhodler
     *
     * @param parent
     * @param viewType
     * @return
     */
    @Override
    public myViewHodler onCreateViewHolder(ViewGroup parent, int viewType) {
        RecyclerView user_peesr_info;//自定义recyclerveiw的适配器

        //创建自定义布局
//        View itemView = View.inflate(context, R.layout.peers_list_item, null);//用这个布局item宽高无效
//        myViewHodler itemView = new myViewHodler(LayoutInflater.from(context).inflate(R.layout.peers_list_item, parent, false));
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.peers_list_item, parent, false);
        user_peesr_info = view.findViewById (R.id.user_peesr_info);
        //给嵌套的RecyclerView设置适配器
        User_Recruitment_Adapter user_recruitment_adapter = new User_Recruitment_Adapter (context,mLinkedList);
        user_peesr_info.setAdapter (user_recruitment_adapter);
        user_peesr_info.setLayoutManager (new LinearLayoutManager (context, LinearLayoutManager.HORIZONTAL, false));
        //给嵌套的RecyclerView设置item的分割线
        user_peesr_info.addItemDecoration (new DividerItemDecoration (context, DividerItemDecoration.HORIZONTAL));
        return new myViewHodler(view);
//        return itemView;
    }

    /**
     * 绑定数据,数据与view绑定
     *
     * @param holder
     * @param position
     */
    @SuppressLint("ClickableViewAccessibility")
    @Override
    public void onBindViewHolder(myViewHodler holder, int position) {
        //根据点击位置绑定数据
        mHome_list_get_set = LinkedList.get(position);
//        holder.mItemGoodsImg;
        holder.user_name.setText(mHome_list_get_set.getUser_name());
        holder.user_industry.setText(mHome_list_get_set.getUser_work());
//        holder.user_portrait.setImageDrawable (data.getHead_portait ());//改为下面Glide获取图上
                Glide.with(context)
                .load(mHome_list_get_set.getHead_portait ())//图片信息
                .apply(RequestOptions.bitmapTransform(new CircleCrop ()))//设置圆形
                .into(holder.user_portrait);//设置到那个部位
        holder.name_voip.setText(mHome_list_get_set.getUser_Vip());
        holder.user_location.setText(mHome_list_get_set.getUser_location());

    }

    /**
     * 得到总条数
     *
     * @return
     */
    @Override
    public int getItemCount() {
//        return LinkedList.size();
        return LinkedList == null ? 0 : LinkedList.size();
    }

    //自定义viewhodler
    class myViewHodler extends RecyclerView.ViewHolder {
        private ImageView user_portrait;
        private TextView user_name;
        private TextView user_industry;
        private TextView name_voip;
        private TextView user_location;
        public RecyclerView user_peesr_info;//自定义recyclerveiw的适配器

        public myViewHodler(View itemView) {
            super(itemView);

            user_peesr_info = itemView.findViewById (R.id.user_peesr_info);
            user_portrait = itemView.findViewById(R.id.user_portrait);
            user_name = itemView.findViewById(R.id.user_name);
            user_industry = itemView.findViewById(R.id.user_industry);
            name_voip = itemView.findViewById(R.id.name_voip);
            user_location = itemView.findViewById(R.id.user_location);

            user_portrait.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    //可以选择直接在本位置直接写业务处理
                    //Toast.makeText(context,"点击了xxx",Toast.LENGTH_SHORT).show();
                    //此处回传点击监听事件
                    if (onItemClickListener != null) {
                        onItemClickListener.OnItemClick(v, LinkedList.get(getLayoutPosition()));

                    }
                }
            });


        }
        public View getItemView() {
            return itemView;

        }
    }

    /**
     * 设置item的监听事件的接口
     */
    public interface OnItemClickListener {
        /**
         * 接口中的点击每一项的实现方法
         *
         * @param view 点击的item的视图
         * @param data 点击的item的数据
         */
        public void OnItemClick(View view, Home_list_get_set data);

    }

    //需要外部访问,所以需要设置set方法,方便调用
    private OnItemClickListener onItemClickListener;

    public void setOnItemClickListener(OnItemClickListener onItemClickListener) {
        this.onItemClickListener = onItemClickListener;
    }


第二个Recyclerview的适配器:

public class User_Recruitment_Adapter extends RecyclerView.Adapter<User_Recruitment_Adapter.myViewHodler> {
    public LinkedList<User_Recruitment_get_set> m_LinkedList;
    private Context context;
    public User_Recruitment_get_set mUser_Recruitment_get_set;
    //创建构造函数
    public User_Recruitment_Adapter(Context context, LinkedList<User_Recruitment_get_set> mLinkedList) {
        //将传递过来的数据,赋值给本地变量
        this.context = context;//上下文
        this.m_LinkedList = mLinkedList;

    }
    @NonNull
    @Override
    public myViewHodler onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
        View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.user_peers_recruitment_item, viewGroup, false);

        return new myViewHodler(view);
    }

    @Override
    public void onBindViewHolder(@NonNull myViewHodler myViewHodler, int i) {
        mUser_Recruitment_get_set = m_LinkedList.get(i);
        myViewHodler.recruitment.setText (mUser_Recruitment_get_set.getRecruitment ());



    }

    @Override
    public int getItemCount() {
        return m_LinkedList == null ? 0 : m_LinkedList.size();
    }

    public class myViewHodler extends RecyclerView.ViewHolder {
            private TextView recruitment;
        public myViewHodler(@NonNull View itemView) {
            super (itemView);
            recruitment = itemView.findViewById(R.id.recruitment);
        }
    }
}

现问题是嵌套里面的Recyclerview无显示内容?我该如何写?

2个回答

看你这么用心,我特意复制了看看,编码风格我就不多说了。但到一半的时候发现你第一个adapter的mLinkedList并没有被初始化过,先创建几个再试一下,另外mLinkedList不要写成成员变量。

删掉:
public LinkedList<\User_Recruitment_get_set> mLinkedList;
User_Recruitment_Adapter user_recruitment_adapter = new User_Recruitment_Adapter (context,mLinkedList);
user_peesr_info.setAdapter (user_recruitment_adapter);
这三行

在onBind里加上
User_Recruitment_Adapter user_recruitment_adapter = new User_Recruitment_Adapter (context,);
uholder.ser_peesr_info.setAdapter (user_recruitment_adapter);
再试试

java基础需要多学学,太乱了

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
NestedScrollView嵌套RecyclerView,滚动事件被拦截
现有两个RecyclerView,每个都嵌套有NestedScrollView,部分代码如下 ``` <android.support.v4.widget.NestedScrollView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:background="@color/global_activity_background_color"> <android.support.v7.widget.RecyclerView android:id="@+id/goods_left_recycler_list" android:layout_width="match_parent" android:layout_height="wrap_content"> </android.support.v7.widget.RecyclerView> </android.support.v4.widget.NestedScrollView> <android.support.v4.widget.NestedScrollView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="4" android:background="@color/global_background_color_white"> <android.support.v7.widget.RecyclerView android:id="@+id/goods_right_recycler_list" android:layout_width="match_parent" android:layout_height="wrap_content"> </android.support.v7.widget.RecyclerView> </android.support.v4.widget.NestedScrollView> ``` 运行截图如下: ![图片说明](https://img-ask.csdn.net/upload/201709/20/1505920340_302225.png) 我想点击左侧的item,右侧能滚动到相应位置,但是目前无任何响应,请问各位该如何解决。
Android RecyclerView滑动出现空指针异常
ViewPager里面是Fragment然后Fragment里面是RecyclerV但是可以正常显示列表,一旦滑动就会出现异常,这个是垂直方向的 然后里面还嵌套了一个水平方向的网格式RecyclerView没有显示出来!TIME=1429828195000 FINGERPRINT=Xiaomi/cancro_wc_lte/cancro:4.4.4/KTU84P/5.4.24:user/release-keys HARDWARE=qcom UNKNOWN=unknown RADIO=unknown BOARD=MSM8974 versionCode=1 PRODUCT=cancro_wc_lte versionName=1.0 DISPLAY=KTU84P USER=builder HOST=qh-miui-ota-bd56 DEVICE=cancro TAGS=release-keys MODEL=MI 4LTE BOOTLOADER=unknown CPU_ABI=armeabi-v7a CPU_ABI2=armeabi IS_DEBUGGABLE=true ID=KTU84P SERIAL=895f2f74 MANUFACTURER=Xiaomi BRAND=Xiaomi TYPE=user java.lang.NullPointerException at android.support.v4.view.ViewCompat$ICSViewCompatImpl.setAccessibilityDelegate(ViewCompat.java:923) at android.support.v4.view.ViewCompat.setAccessibilityDelegate(ViewCompat.java:1343) at android.support.v7.widget.RecyclerView$Recycler.addViewHolderToRecycledViewPool(RecyclerView.java:3900) at android.support.v7.widget.RecyclerView$Recycler.recycleCachedViewAt(RecyclerView.java:3843) at android.support.v7.widget.RecyclerView$Recycler.recycleViewHolderInternal(RecyclerView.java:3880) at android.support.v7.widget.RecyclerView$Recycler.recycleView(RecyclerView.java:3804) at android.support.v7.widget.RecyclerView$LayoutManager.removeAndRecycleViewAt(RecyclerView.java:5529) at android.support.v7.widget.LinearLayoutManager.recycleChildren(LinearLayoutManager.java:1143) at android.support.v7.widget.LinearLayoutManager.recycleViewsFromEnd(LinearLayoutManager.java:1218) at android.support.v7.widget.LinearLayoutManager.recycleByLayoutState(LinearLayoutManager.java:1242) at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1268) at android.support.v7.widget.LinearLayoutManager.scrollBy(LinearLayoutManager.java:1102) at android.support.v7.widget.LinearLayoutManager.scrollVerticallyBy(LinearLayoutManager.java:959) at android.support.v7.widget.RecyclerView$ViewFlinger.run(RecyclerView.java:3062) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761) at android.view.Choreographer.doCallbacks(Choreographer.java:574) at android.view.Choreographer.doframe(Choreographer.java:543) at android.view.Choreographer$frameDisplayEventReceiver.run(Choreographer.java:747) at android.os.Handler.handleCallback(Handler.java:733) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5047) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:806) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:622) at dalvik.system.NativeStart.main(Native Method)
更新Fragment中RecyclerView的数据
Fragment的布局只包含了RecyclerView。现在,我可以获得正常的数据,但是需要通过service,获得数据更新后,对recycler中的UI进行更新,比如对textview,进行新的赋值。找了很多办法,都没法更新。请教一下,有什么样的思路,或者方法可以讲解一下,谢谢!
求教Android中RecyclerView的ViewHolder的一些问题
初学Android,看了一些代码,基本上适配器的代码都是这么写的 ``` public class NewAdapter extends RecyclerView.Adapter <NewAdapter.ViewHolder> { private List<String> data; static class ViewHolder extends RecyclerView.ViewHolder { Button number; Button name; public ViewHolder(View view) { super(view); number=view.findViewById(R.id.text1); name=view.findViewById(R.id.text2); } } public NewAdapter(List<String> data) { this.data=data; } @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View view= LayoutInflater.from(parent.getContext()).inflate(R.layout.recycler,parent,false); ViewHolder holder=new ViewHolder(view); return holder; } @Override public void onBindViewHolder(ViewHolder holder, int position) { String name=data.get(position); holder.number.setText(String.valueOf(position)); holder.name.setText(name); } @Override public int getItemCount() { return data.size(); } } ``` 代码中有个ViewHolder,都说ViewHolder可以加载Item的布局可以节省findViewByID操作。但是每次当滚动需要显示新的Item都会调用onCreateViewHolder,而每次调用都会创建一个新View让ViewHolder加载,这样不就没有节省吗? 还有就是不太明白onCreateViewHolder的返回值是用到onBindViewHolder上了么。 那样要滚动显示一个Item的步骤是不是先调用onCreateViewHolder,创建出一个ViewHolder,其中包含着要显示的Item中的的Button,TextView一类的实例。然后将这个ViewHolder作为参数调用onBindViewHolder,然后将Item中的Button,TextView置上数据??
求教Android中RecyclerView中的ViewHolder的一些问题
求教Android中RecyclerView中的ViewHolder的一些问题 网上的适配器的代码都是这么写的 ``` public class NewAdapter extends RecyclerView.Adapter <NewAdapter.ViewHolder> { private List<String> data; static class ViewHolder extends RecyclerView.ViewHolder { Button number; Button name; public ViewHolder(View view) { super(view); number=view.findViewById(R.id.text1); name=view.findViewById(R.id.text2); } } public NewAdapter(List<String> data) { this.data=data; } @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View view= LayoutInflater.from(parent.getContext()).inflate(R.layout.recycler,parent,false); ViewHolder holder=new ViewHolder(view); return holder; } @Override public void onBindViewHolder(ViewHolder holder, int position) { String name=data.get(position); holder.number.setText(String.valueOf(position)); holder.name.setText(name); } @Override public int getItemCount() { return data.size(); } } ``` 然后ViewHolder有点搞不明白,很多人都说ViewHolder可以节省findViewByID的使用,提高性能。但是每次滚动显示一个新Item的时候不都会调用onCreateViewHolder方法吗?这样不还是需要每次都调用findViewById,这样怎么就提升性能? 还有想求教一下,显示一个Item的顺序是 先调用onCreateViewHolder,得到新的ViewHolder,然后将ViewHolder作为参数调用onBindViewHolder,来将其中绑定的实例置上数据吗?
RecyclerView 的onBindViewHolder出现空指针异常
package com.example.haha.note; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import java.util.ArrayList; import java.util.List; import java.util.Random; /** * Created by haha on 2017/9/8. */ public class NotesTitleFragment extends Fragment { private boolean isTwoPane; public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){ View view=inflater.inflate(R.layout.notes_title_frag,container,false); RecyclerView noteTitleRecyclerView=(RecyclerView) view.findViewById(R.id.notes_title_recycler_view); LinearLayoutManager layoutManager=new LinearLayoutManager(getActivity()); noteTitleRecyclerView.setLayoutManager(layoutManager); NoteAdapter adapter=new NoteAdapter(getNote()); noteTitleRecyclerView.setAdapter(adapter); return view; } private List<notes> getNote(){ List<notes> notesList=new ArrayList<>(); for(int i=1;i<=50;i++){ notes note=new notes(); note.setTitle("This is title" + i); note.setContent(getRandomLengthContent("This is note content"+i+".")); notesList.add(note); } return notesList; } private String getRandomLengthContent(String content){ Random random=new Random(); int length=random.nextInt(20)+1; StringBuilder builder=new StringBuilder(); for(int i=0;i<length;i++){ builder.append(content); } return builder.toString(); } public void onActivityCreated(Bundle savedInstanceState){ super.onActivityCreated(savedInstanceState); if(getActivity().findViewById(R.id.notes_content_layout) !=null){ isTwoPane=true; } else isTwoPane=false; } class NoteAdapter extends RecyclerView.Adapter<NoteAdapter.ViewHolder>{ private List<notes> mNoteList; class ViewHolder extends RecyclerView.ViewHolder{ TextView noteTitleText; public ViewHolder(View view){ super(view); noteTitleText=(TextView) view.findViewById(R.id.note_title); } } public NoteAdapter(List<notes> notesList){ mNoteList=notesList; } @Override public ViewHolder onCreateViewHolder(ViewGroup parent,int viewType){ View view=LayoutInflater.from(parent.getContext()).inflate(R.layout.notes_item,parent,false); final ViewHolder holder=new ViewHolder(view); view.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { notes note=mNoteList.get(holder.getAdapterPosition()); if(isTwoPane){ NotesContentFragment notesContentFragment=(NotesContentFragment) getFragmentManager().findFragmentById(R.id.notes_content_fragment); notesContentFragment.refresh(note.getTitle(),note.getContent()); }else { notesContentActivity.actionStart(getActivity(),note.getTitle(),note.getContent()); } } }); return holder; } public void onBindViewHolder(ViewHolder holder,int position){ notes note=mNoteList.get(position); holder.noteTitleText.setText(note.getTitle()); } public int getItemCount(){ return mNoteList.size(); } } } 看了很多网上得解决办法还是没解决问题,小白求教
recyclerView的数据无法一次性更新出来(fragment)
我是用XUtils3的网络框架 ![这是展示解析出来的信息界面](https://img-ask.csdn.net/upload/201607/21/1469071154_861920.png) 问题:运行这个App然后点到“消息”界面(fragment),只能显示一条数据,当我切换到别的界面,然后又切换回“消息”界面,又刷新出两条数据;当全部数据全部显示出来以后,再次切换界面就会报错 代码如下 @ContentView(R.layout.fragment_message) public class Message extends Fragment { String url = "http://dxy.com/app/i/feed/tags2sub/list"; private String TAG = "Message"; private List<MessageInfo.DataBean.ItemsBean> messageList = new ArrayList<>(); @ViewInject(R.id.message_recycler) private RecyclerView message_recycler; private MyAdapter mAdapter; public Message() { // Required empty public constructor } @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = x.view().inject(this, inflater, container); //数据初始化 initData(); message_recycler.setHasFixedSize(true); message_recycler.setLayoutManager(new LinearLayoutManager(getActivity())); mAdapter = new MyAdapter(); message_recycler.setAdapter(mAdapter); return view; } /** * 点击事件 * @param view */ @Event(R.id.message) private void onClick(View view){ startActivity(new Intent(getActivity(), MessageActivity.class)); } /** * 解析数据 */ private void initData() { HashMap<String, String> map = new HashMap<>(); map.put("ac", "d5424fa6-adff-4b0a-8917-4264daf4a348"); HttpUtils.get(url, map, new MyCallBack<String>() { @Override public void onSuccess(String result) { // Toast.makeText(getActivity(), ""+result, Toast.LENGTH_SHORT).show(); Gson gson = new Gson(); MessageInfo messageInfo = gson.fromJson(result, MessageInfo.class); List<MessageInfo.DataBean.ItemsBean> items = messageInfo.getData().getItems(); messageList.addAll(items); // mAdapter.notifyItemRangeInserted(0, messageList.size()); mAdapter.notifyDataSetChanged(); Toast.makeText(getActivity(), "--------" + messageList.size(), Toast.LENGTH_SHORT).show(); } }); } /** * recyeler适配器 */ class MyAdapter extends RecyclerView.Adapter<MyAdapter.MyHolder>{ @Override public MyHolder onCreateViewHolder(ViewGroup parent, int viewType) { View view = getActivity().getLayoutInflater().inflate(R.layout.message_recycler_item, parent, false); MyHolder myHolder = new MyHolder(view); return myHolder; } @Override public void onBindViewHolder(MyHolder holder, int position) { MessageInfo.DataBean.ItemsBean itemsBean = messageList.get(position); holder.mHb_pressure.setText(itemsBean.getTags().get(position).getTag_name()); holder.mIntroduction.setText(itemsBean.getTags().get(position).getContent()); // notifyItemChanged(position); // holder.itemView.setTag(itemsBean); } @Override public int getItemCount() { return messageList.size(); } class MyHolder extends RecyclerView.ViewHolder{ private final TextView mHb_pressure; private final TextView mIntroduction; public MyHolder(View itemView) { super(itemView); mHb_pressure = (TextView) itemView.findViewById(R.id.HB_pressure); mIntroduction = (TextView) itemView.findViewById(R.id.Introduction); } } } }
android 两个页面都用recyclerview,一个正常,另一个报错
第一个页面(没问题) ``` @BindView(R.id.title_tv) TextView titleTv; @BindView(R.id.recycler) RecyclerView recyclerView; @BindView(R.id.refresh) SwipeRefreshLayout refreshLayout; @BindView(R.id.no_details) LinearLayout noDetails; List<WalletDetailsBean.ResultBean.ListBean> transactionList = new ArrayList<WalletDetailsBean.ResultBean.ListBean>(); private TransactionListAdapter adapter; private String token; private int page = 1; .... protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_wallet_details); ButterKnife.bind(this); Intent intent = getIntent(); if(intent != null){ token = intent.getStringExtra("token") != null ? intent.getStringExtra("token") : " "; } initTitle(); initView(); initData(token); } .... private void initView() { refreshLayout.setOnRefreshListener(this); refreshLayout.setColorSchemeResources(android.R.color.holo_blue_bright, android.R.color.holo_green_light, android.R.color.holo_orange_light, android.R.color.holo_red_light); refreshLayout.setProgressBackgroundColor(R.color.refresh_bg); initListView(); } private void initListView() { layoutManager = new LinearLayoutManager(this); layoutManager.setOrientation(LinearLayoutManager.VERTICAL); recyclerView.setLayoutManager(layoutManager); adapter = new TransactionListAdapter(this, transactionList); recyclerView.setAdapter(adapter); recyclerView.setBackgroundColor(Color.WHITE); // 第一次进入页面的时候显示加载进度条 refreshLayout.setProgressViewOffset(true, 0, (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 24, getResources().getDisplayMetrics())); refreshLayout.setRefreshing(true); //滚动监听 recyclerView.setOnScrollListener(new RecyclerView.OnScrollListener() { @Override public void onScrollStateChanged(RecyclerView recyclerView, int newState) { super.onScrollStateChanged(recyclerView, newState); if (newState == RecyclerView.SCROLL_STATE_IDLE && lastVisibleItem + 1 == adapter.getItemCount()) { refreshLayout.setRefreshing(true); page++; if (page <= totalPage) { //根据后台接口 判断当前页是否小于总页 L.e("pageNo:" + page + ",totalPage:" + totalPage); queryTransactionDetails(MywalletDetailActivity.this,token,page); showToast(getResources().getString(R.string.loading)); } else { refreshLayout.setRefreshing(false); showToast(getString(R.string.no_more_data)); } } } @Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) { super.onScrolled(recyclerView, dx, dy); lastVisibleItem = layoutManager.findLastVisibleItemPosition(); } }); } ``` 两个页面的xml文件都差不多: ``` <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> ... <android.support.v4.widget.SwipeRefreshLayout android:id="@+id/refresh" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.v7.widget.RecyclerView android:id="@+id/recycler" android:paddingTop="@dimen/common_10" android:background="#eaeaea" android:layout_width="match_parent" android:layout_height="match_parent"/> </android.support.v4.widget.SwipeRefreshLayout> </LinearLayout> ``` 第二个页面: ``` @BindView(R.id.title_tv) TextView titleTv; @BindView(R.id.no_schedule_ll) LinearLayout noScheduleLl; @BindView(R.id.recycler) RecyclerView recyclerView; @BindView(R.id.refresh_myschedule) SwipeRefreshLayout refreshLayout; ... @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_my_schedule); ButterKnife.bind(this); withRefreshView = setRefreshView(); intent = getIntent(); userid = intent.getStringExtra("userid"); token = intent.getStringExtra("token"); initView(); loadFromNet(token,pageNo); } /** * 初始化控件 */ private void initView() { titleTv.setText(getResources().getString(R.string.my_schedule)); needHelp.setVisibility(View.VISIBLE); needHelp.setText(getResources().getString(R.string.need_help)); refreshLayout.setOnRefreshListener(this); refreshLayout.setColorSchemeResources(android.R.color.holo_blue_bright, android.R.color.holo_green_light, android.R.color.holo_orange_light, android.R.color.holo_red_light); refreshLayout.setProgressBackgroundColor(R.color.refresh_bg); refreshLayout.setRefreshing(true); /* * 第一次进入页面的时候显示加载进度条 */ refreshLayout.setProgressViewOffset(true, 0, (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 24, getResources().getDisplayMetrics())); refreshLayout.setRefreshing(true); initListView(); } private void initListView() { recyclerView.setItemAnimator(new DefaultItemAnimator());//设置item动画 recyclerView.setHasFixedSize(true); //如果可以确定每个item的高度是固定的,设置这个选项可以提高性能 //创建默认的线性LayoutManage layoutManager = new LinearLayoutManager(this); layoutManager.setOrientation(LinearLayoutManager.VERTICAL); recyclerView.setLayoutManager(layoutManager); recyclerView.setBackgroundColor(Color.WHITE); recyclerView.addItemDecoration(new MyDecoration(this, MyDecoration.VERTICAL_LIST));//自定义的分隔线 adapter = new ScheduleAdapter(this, scheduleList); adapter.setOnItemClickListener(new ScheduleAdapter.OnItemClickListener() { @Override public void onItemClick(View view, int position) { startActivity(new Intent(MyScheduleActivity.this, ShowWebViewActivity.class) .putExtra("title",getResources().getString(R.string.riding_details_title)) .putExtra("share",getResources().getString(R.string.riding_details_share)) .putExtra("url", Url.getMyScheduleDetailUrl(true) + "?token=" + token +"&id=" + rideId)); } }); adapter.setOnItemLongClickListener(new ScheduleAdapter.OnItemLongClickListener() { @Override public void onItemLongClick(View view, int position) { } }); recyclerView.setAdapter(adapter); recyclerView.setOnScrollListener(new RecyclerView.OnScrollListener() { @Override public void onScrollStateChanged(RecyclerView recyclerView, int newState) { super.onScrollStateChanged(recyclerView, newState); if (newState == RecyclerView.SCROLL_STATE_IDLE && lastVisibleItem + 1 == adapter.getItemCount()) { refreshLayout.setRefreshing(true); pageNo++; if (pageNo <= totalPage) { //根据后台接口 判断当前页是否小于总页 L.e("pageNo:" + pageNo + "newsTotalPage:" + totalPage); loadFromNet(token, pageNo); showToast(getResources().getString(R.string.loading)); } else { refreshLayout.setRefreshing(false); showToast(getString(R.string.no_more_data)); } } } @Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) { super.onScrolled(recyclerView, dx, dy); lastVisibleItem = layoutManager.findLastVisibleItemPosition(); } }); } ``` 跳转到第一个页面正常显示列表,跳转到第二个页面的时候报错 ![图片说明](https://img-ask.csdn.net/upload/201703/26/1490522733_865990.png) 请问是怎么回事,看了一天了还是看不出所以然来。 谢谢~
使用PhotoPicker和recycleview时报错
java.lang.NoSuchMethodError: No static method clear(Landroid/view/View;)V in class Lcom/bumptech/glide/Glide; or its super classes (declaration of 'com.bumptech.glide.Glide' appears in /data/app/com.sdai.shiyong-1/split_lib_dependencies_apk.apk) at me.iwf.photopicker.adapter.PhotoGridAdapter.onViewRecycled(PhotoGridAdapter.java:219) at me.iwf.photopicker.adapter.PhotoGridAdapter.onViewRecycled(PhotoGridAdapter.java:27) at android.support.v7.widget.RecyclerView$Recycler.dispatchViewRecycled(RecyclerView.java:6216) at android.support.v7.widget.RecyclerView$Recycler.addViewHolderToRecycledViewPool(RecyclerView.java:5987) at android.support.v7.widget.RecyclerView$Recycler.recycleViewHolderInternal(RecyclerView.java:5948) at android.support.v7.widget.RecyclerView$LayoutManager.scrapOrRecycleView(RecyclerView.java:8617) at android.support.v7.widget.RecyclerView$LayoutManager.detachAndScrapAttachedViews(RecyclerView.java:8602) at android.support.v7.widget.StaggeredGridLayoutManager.onLayoutChildren(StaggeredGridLayoutManager.java:666) at android.support.v7.widget.StaggeredGridLayoutManager.onLayoutChildren(StaggeredGridLayoutManager.java:604) at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3719) at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:3436) at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3988) 请教大神怎么解决啊
怎样实现点击Recycler的item,跳到相应的activity?
怎样实现点击Recycler的item,跳到相应的activity?试了下,不能在adapter里用平常的按钮点击跳转activity。
android 求问一个recyclerview的问题!
recycler在绑定数据的时候,能够绑定一个ArrayList的列表数据的吗? 就如,在数据源中 List<> datalist = new ArrayList<>(); ArrayList<HashMap<String,Object>> list = new ArrayList<HashMap<String,Object>>(); Hashmap<String,Object> map = new HashMap<>(); map.put("key",datalist); ``` ``` 在adapter的onBindView中获取。 类似于这样。 可以这样传递list的吗? 调试过程中发现,在map.put()中传入数据,在onBindView中get取出来时报了nullpointexcepttion,而且传入其它的字符串数据也是不行,也会报错!! 关键是,之前绑定的数据还是可以获取,后来新增的就全都不行了! 到底是什么问题呢!!求问!!
elasticsearch容器无法访问
搭建springcloud的基础运行环境,elasticsearch容器访问不到,端口已经进行过影射了。 elasticsearch6.2版本在 虚拟机Ubuntu16.04 上的 Docker容器 docker内环境为CentOS7 虚拟机内存8G,el给了2G,ip也对,求救help!!!!! 下面出测试: ``` Ubuntu内测试 curl 192.168.9.131:9200 curl: (7) Failed to connect to 192.168.9.131 port 9200: 拒绝连接 虚拟机防火墙状态: root@SpringEnv:/home/mfz# systemctl status firewalld.service ● firewalld.service - firewalld - dynamic firewall daemon Loaded: loaded (/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled) Active: inactive (dead) since 一 2019-11-11 21:27:25 CST; 57min ago Process: 866 ExecStart=/usr/sbin/firewalld --nofork --nopid (code=exited, status=0/SUCCESS) Main PID: 866 (code=exited, status=0/SUCCESS) ``` 在宿主机测试 ``` C:\Users\54185>telnet 192.168.9.131:9200 正在连接192.168.9.131:9200...无法打开到主机的连接。 在端口 23: 连接失败 ``` 容器在运行 ![图片说明](https://img-ask.csdn.net/upload/201911/11/1573482500_464628.png) 以下为配置文件: jvm.options ``` ## JVM configuration ################################################################ ## IMPORTANT: JVM heap size ################################################################ ## ## You should always set the min and max JVM heap ## size to the same value. For example, to set ## the heap to 4 GB, set: ## ## -Xms4g ## -Xmx4g ## ## See https://www.elastic.co/guide/en/elasticsearch/reference/current/heap-size.html ## for more information ## ################################################################ # Xms represents the initial size of total heap space # Xmx represents the maximum size of total heap space -Xms2g -Xmx2g ################################################################ ## Expert settings ################################################################ ## ## All settings below this section are considered ## expert settings. Don't tamper with them unless ## you understand what you are doing ## ################################################################ ## GC configuration -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly ## optimizations # pre-touch memory pages used by the JVM during initialization -XX:+AlwaysPreTouch ## basic # explicitly set the stack size -Xss1m # set to headless, just in case -Djava.awt.headless=true # ensure UTF-8 encoding by default (e.g. filenames) -Dfile.encoding=UTF-8 # use our provided JNA always versus the system one -Djna.nosys=true # turn off a JDK optimization that throws away stack traces for common # exceptions because stack traces are important for debugging -XX:-OmitStackTraceInFastThrow # flags to configure Netty -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dio.netty.recycler.maxCapacityPerThread=0 # log4j 2 -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -Djava.io.tmpdir=${ES_TMPDIR} ## heap dumps # generate a heap dump when an allocation from the Java heap fails # heap dumps are created in the working directory of the JVM -XX:+HeapDumpOnOutOfMemoryError # specify an alternative path for heap dumps # ensure the directory exists and has sufficient space #-XX:HeapDumpPath=/heap/dump/path ## JDK 8 GC logging 8:-XX:+PrintGCDetails 8:-XX:+PrintGCDateStamps 8:-XX:+PrintTenuringDistribution 8:-XX:+PrintGCApplicationStoppedTime 8:-Xloggc:logs/gc.log 8:-XX:+UseGCLogFileRotation 8:-XX:NumberOfGCLogFiles=32 8:-XX:GCLogFileSize=64m # JDK 9+ GC logging 9-:-Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m # due to internationalization enhancements in JDK 9 Elasticsearch need to set the provider to COMPAT otherwise # time/date parsing will break in an incompatible way for some date patterns and locals 9-:-Djava.locale.providers=COMPAT ``` elasticsearch.yml ``` # ======================== Elasticsearch Configuration ========================= # # NOTE: Elasticsearch comes with reasonable defaults for most settings. # Before you set out to tweak and tune the configuration, make sure you # understand what are you trying to accomplish and the consequences. # # The primary way of configuring a node is via this file. This template lists # the most important settings you may want to configure for a production cluster. # # Please consult the documentation for further information on configuration options: # https://www.elastic.co/guide/en/elasticsearch/reference/index.html # # ---------------------------------- Cluster ----------------------------------- # # Use a descriptive name for your cluster: # cluster.name: elasticsearch-application # # ------------------------------------ Node ------------------------------------ # # Use a descriptive name for the node: # #node.name: node-1 # # Add custom attributes to the node: # #node.attr.rack: r1 # # ----------------------------------- Paths ------------------------------------ # # Path to directory where to store the data (separate multiple locations by comma): # "elasticsearch.yml" 94L, 2864C # Path to log files: # #path.logs: /path/to/logs # # ----------------------------------- Memory ----------------------------------- # # Lock the memory on startup: # #bootstrap.memory_lock: true # # Make sure that the heap size is set to about half the memory available # on the system and that the owner of the process is allowed to use this # limit. # # Elasticsearch performs poorly when the system is swapping the memory. # # ---------------------------------- Network ----------------------------------- # # Set the bind address to a specific IP (IPv4 or IPv6): # # http.port: 9200 network.host: 0.0.0.0 # # Set a custom port for HTTP: # # # For more information, consult the network module documentation. # # --------------------------------- Discovery ---------------------------------- # # Pass an initial list of hosts to perform discovery when new node is started: # The default list of hosts is ["127.0.0.1", "[::1]"] # #discovery.zen.ping.unicast.hosts: ["host1", "host2"] # # Prevent the "split brain" by configuring the majority of nodes (total number of master-eligible nodes / 2 + 1): # #discovery.zen.minimum_master_nodes: # # For more information, consult the zen discovery module documentation. # # ---------------------------------- Gateway ----------------------------------- # # Block initial recovery after a full cluster restart until N nodes are started: # #gateway.recover_after_nodes: 3 # # For more information, consult the gateway module documentation. # # ---------------------------------- Various ----------------------------------- # # Require explicit names when deleting indices: # #action.destructive_requires_name: true ```
进入页面虚拟机崩溃,找不到错误,求大神帮改下源码,谢谢啦
import android.app.Activity; import android.os.AsyncTask; import android.os.Bundle; import android.support.v7.widget.DefaultItemAnimator; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.StaggeredGridLayoutManager; import android.view.View; import android.widget.Toast; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; import java.net.URL; import java.util.ArrayList; import java.util.List; public class StartCanteenActivity extends Activity { private static final String urlPath = "http://www.imooc.com/api/teacher?type=4&num=30"; //private static final String urlPath = "http://14.117.17.161/json.php"; private RecyclerView mRvDemoMain; private MyRecyclerAdapter mAdapter; private List<NewsBeam> mList; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.canteen); mRvDemoMain = (RecyclerView) findViewById(R.id.canteen_recyclerview); new NewAsyncTask().execute(urlPath); initView(); } /** * 初始化本页面的控件 */ private void initView() { mRvDemoMain.setAdapter(mAdapter); // 设置RecyclerView的布局管理器 mRvDemoMain.setLayoutManager(new StaggeredGridLayoutManager(3, StaggeredGridLayoutManager.VERTICAL)); mRvDemoMain.setItemAnimator(new DefaultItemAnimator()); // 调用Adapter中的设置监听器的方法 mAdapter.setOnItemClickListener(new MyRecyclerAdapter.OnItemClickListener() { @Override public void onItemClick(View view, int position) { Toast.makeText(StartCanteenActivity.this, "click : " + position, Toast.LENGTH_SHORT).show(); } }); } /** * 实现网络的异步访问 */ class NewAsyncTask extends AsyncTask<String, Void, List<NewsBeam>> { @Override protected void onPostExecute(List<NewsBeam> newsBeams) { super.onPostExecute(newsBeams); MyRecyclerAdapter adapter = new MyRecyclerAdapter(StartCanteenActivity.this, newsBeams, mRvDemoMain); mRvDemoMain.setAdapter(adapter); } @Override protected List<NewsBeam> doInBackground(String... params) { return getJsonData(params[0]); } /** * 从 URL 中获取数据 * * @param url * @return */ private List<NewsBeam> getJsonData(String url) { List<NewsBeam> newsBeamsList = new ArrayList<NewsBeam>(); try { String jsonString = readStream(new URL(urlPath).openStream()); JSONObject jsonObject; NewsBeam newsBeam; jsonObject = new JSONObject(jsonString); JSONArray jsonArray = jsonObject.getJSONArray("data"); for(int i = 0; i < jsonArray.length(); i++) { jsonObject = jsonArray.getJSONObject(i); newsBeam = new NewsBeam(); newsBeam.newsIconUrl = jsonObject.getString("picSmall"); newsBeam.newsTitle = jsonObject.getString("name"); newsBeamsList.add(newsBeam); } } catch(IOException e) { e.printStackTrace(); } catch(JSONException e) { e.printStackTrace(); } return newsBeamsList; } /** * 从 inpustStream 获取的信息 * * @param is * @return */ private String readStream(InputStream is) { InputStreamReader isr; String result = ""; try { isr = new InputStreamReader(is, "utf-8"); BufferedReader br = new BufferedReader(isr); String line = ""; while((line = br.readLine()) != null) { result += line; } } catch(UnsupportedEncodingException e) { e.printStackTrace(); } catch(IOException e) { e.printStackTrace(); } return result; } } } import android.content.Context; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import java.util.ArrayList; import java.util.List; public class MyRecyclerAdapter extends RecyclerView.Adapter<MyRecyclerAdapter.MyRecyclerHolder> { protected LayoutInflater mLayoutInflater; private Context mContext; protected List<NewsBeam> mList; private List<Integer> mHeights; // 随机高度的集合 private ImgLoader mImgLoader; private int mStart; private int mEnd; public static String[] URLS; private boolean mFirstIn; private MyRecyclerAdapter(List<NewsBeam> mList) { this.mList = mList; } /** * 自定义一个OnItemClickListener的回调接口 */ public interface OnItemClickListener{ void onItemClick(View view, int position); } /** * 创建接口的成员变量 */ private OnItemClickListener mOnItemClickListener; /** * 设置监听器的方法 * @param listener listener */ public void setOnItemClickListener(OnItemClickListener listener){ this.mOnItemClickListener = listener; } /** * 构造方法 * @param context context * @param data data */ public MyRecyclerAdapter(Context context, List<NewsBeam> data,RecyclerView recyclerView) { this.mContext = context; this.mList = data; mLayoutInflater = LayoutInflater.from(mContext); mImgLoader = new ImgLoader(recyclerView); mLayoutInflater = LayoutInflater.from(mContext); mHeights = new ArrayList<Integer>(); // 向随机高度集合中添加随机数(100 ~ 400) for (int i = 0; i < mList.size(); i++) { mHeights.add((int) (100 + Math.random() * 300)); } URLS = new String[data.size()]; for(int i = 0; i < data.size(); i++) { URLS[i] = data.get(i).newsIconUrl; } mFirstIn = true; } /** * RecyclerView中条目的数量 * * @return count */ @Override public int getItemCount() { return mList.size(); } /** * 创建ViewHolder * * @param parent parent * @param viewType viewType * @return holder */ @Override public MyRecyclerHolder onCreateViewHolder(ViewGroup parent, int viewType) { // zz 测试 System.out.println("====onCreateViewHolder : " + viewType + " == " + parent); View view = mLayoutInflater.inflate(R.layout.recycler_item, parent, false); MyRecyclerHolder mHolder = new MyRecyclerHolder(view); return mHolder; } /** * 绑定ViewHolder * * @param holder holder * @param position position */ @Override public void onBindViewHolder(final MyRecyclerHolder holder, final int position) { // 为ViewHolder的父控件(也即一条Item)设置高度 ViewGroup.LayoutParams lp = holder.itemView.getLayoutParams(); lp.height = mHeights.get(position); holder.itemView.setLayoutParams(lp); holder.mIvItem.setImageBitmap(null); holder.mIvItem.setImageResource(R.mipmap.ic_launcher); String url = mList.get(position).newsIconUrl; holder.mIvItem.setTag(url); mImgLoader.showImgByAysncTask(holder.mIvItem, url); holder.mTvItem.setText(mList.get(position).newsTitle); // 调用条目的点击事件设置方法 setUpItemEvent(holder); // zz 测试 System.out.println("====onBindViewHolder : " + position + " == " + holder); } /** * 设置条目的点击事件(点按) * @param holder holder */ protected void setUpItemEvent(final MyRecyclerHolder holder) { if (mOnItemClickListener != null) { holder.itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { int layoutPosition = holder.getLayoutPosition(); mOnItemClickListener.onItemClick(holder.itemView, layoutPosition); } }); } } /** * RecyclerView的ViewHolder类 */ public class MyRecyclerHolder extends RecyclerView.ViewHolder { ImageView mIvItem; TextView mTvItem; public MyRecyclerHolder(View itemView) { super(itemView); mIvItem = (ImageView) itemView.findViewById(R.id.id_image); mTvItem = (TextView) itemView.findViewById(R.id.id_name); } } }
哪位好心的大侠帮我看一下代码,不知道为什么一运行虚拟机就崩溃,谢谢啦
import android.content.Context; import android.os.AsyncTask; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.DefaultItemAnimator; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.StaggeredGridLayoutManager; import android.view.View; import android.widget.Toast; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; import java.net.URL; import java.util.ArrayList; import java.util.List; public class StartCanteenActivity extends AppCompatActivity { private RecyclerView mRvDemoMain; private Context mContext; private List<NewsBeam> mList; private MyRecyclerAdapter mAdapter; private static final String urlPath = "http://www.imooc.com/api/teacher?type=4&num=30"; //private static final String urlPath = "http://14.117.17.161/json.php"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.canteen); // 1. 初始化RecyclerView中要显示的数据 initData(); // 2. 初始化本页面的控件 initView(); } /** * 初始化RecyclerView中要显示的数据 */ private void initData() { } /** * 初始化本页面的控件 */ private void initView() { mRvDemoMain = (RecyclerView) findViewById(R.id.canteen_recyclerview); // 设置RecyclerView的Adapter mAdapter = new MyRecyclerAdapter(mContext,mList,mRvDemoMain); mRvDemoMain.setAdapter(mAdapter); // zz 测试 System.out.println("==== mRvDemoMain.setAdapter(mAdapter)执行完了"); mRvDemoMain.setLayoutManager(new StaggeredGridLayoutManager(3, StaggeredGridLayoutManager.VERTICAL)); mRvDemoMain.setItemAnimator(new DefaultItemAnimator()); // 调用Adapter中的设置监听器的方法 mAdapter.setOnItemClickListener(new MyRecyclerAdapter.OnItemClickListener() { @Override public void onItemClick(View view, int position) { Toast.makeText(StartCanteenActivity.this, "click : " + position, Toast.LENGTH_SHORT).show(); } }); } /** * 实现网络的异步访问 */ class NewAsyncTask extends AsyncTask<String, Void, List<NewsBeam>> { @Override protected void onPostExecute(List<NewsBeam> newsBeams) { super.onPostExecute(newsBeams); MyRecyclerAdapter adapter = new MyRecyclerAdapter(StartCanteenActivity.this, newsBeams, mRvDemoMain); mRvDemoMain.setAdapter(adapter); } @Override protected List<NewsBeam> doInBackground(String... params) { return getJsonData(params[0]); } /** * 从 URL 中获取数据 * * @param url * @return */ private List<NewsBeam> getJsonData(String url) { List<NewsBeam> newsBeamsList = new ArrayList<NewsBeam>(); try { String jsonString = readStream(new URL(urlPath).openStream()); JSONObject jsonObject; NewsBeam newsBeam; jsonObject = new JSONObject(jsonString); JSONArray jsonArray = jsonObject.getJSONArray("data"); for(int i = 0; i < jsonArray.length(); i++) { jsonObject = jsonArray.getJSONObject(i); newsBeam = new NewsBeam(); newsBeam.newsIconUrl = jsonObject.getString("picSmall"); newsBeam.newsTitle = jsonObject.getString("name"); newsBeamsList.add(newsBeam); } } catch(IOException e) { e.printStackTrace(); } catch(JSONException e) { e.printStackTrace(); } return newsBeamsList; } /** * 从 inpustStream 获取的信息 * * @param is * @return */ private String readStream(InputStream is) { InputStreamReader isr; String result = ""; try { isr = new InputStreamReader(is, "utf-8"); BufferedReader br = new BufferedReader(isr); String line = ""; while((line = br.readLine()) != null) { result += line; } } catch(UnsupportedEncodingException e) { e.printStackTrace(); } catch(IOException e) { e.printStackTrace(); } return result; } } } import android.content.Context; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import java.util.ArrayList; import java.util.List; public class MyRecyclerAdapter extends RecyclerView.Adapter<MyRecyclerAdapter.MyRecyclerHolder> { protected LayoutInflater mLayoutInflater; private Context mContext; protected List<NewsBeam> mList; private List<Integer> mHeights; // 随机高度的集合 private ImgLoader mImgLoader; private int mStart; private int mEnd; public static String[] URLS; private boolean mFirstIn; private MyRecyclerAdapter(List<NewsBeam> mList) { this.mList = mList; } /** * 自定义一个OnItemClickListener的回调接口 */ public interface OnItemClickListener{ void onItemClick(View view, int position); } /** * 创建接口的成员变量 */ private OnItemClickListener mOnItemClickListener; /** * 设置监听器的方法 * @param listener listener */ public void setOnItemClickListener(OnItemClickListener listener){ this.mOnItemClickListener = listener; } /** * 构造方法 * @param context context * @param data data */ public MyRecyclerAdapter(Context context, List<NewsBeam> data,RecyclerView recyclerView) { this.mContext = context; this.mList = data; mLayoutInflater = LayoutInflater.from(mContext); mImgLoader = new ImgLoader(recyclerView); mLayoutInflater = LayoutInflater.from(mContext); mHeights = new ArrayList<Integer>(); // 向随机高度集合中添加随机数(100 ~ 400) for (int i = 0; i < mList.size(); i++) { mHeights.add((int) (100 + Math.random() * 300)); } URLS = new String[data.size()]; for(int i = 0; i < data.size(); i++) { URLS[i] = data.get(i).newsIconUrl; } mFirstIn = true; } /** * RecyclerView中条目的数量 * * @return count */ @Override public int getItemCount() { return mList.size(); } /** * 创建ViewHolder * * @param parent parent * @param viewType viewType * @return holder */ @Override public MyRecyclerHolder onCreateViewHolder(ViewGroup parent, int viewType) { // zz 测试 System.out.println("====onCreateViewHolder : " + viewType + " == " + parent); View view = mLayoutInflater.inflate(R.layout.recycler_item, parent, false); MyRecyclerHolder mHolder = new MyRecyclerHolder(view); return mHolder; } /** * 绑定ViewHolder * * @param holder holder * @param position position */ @Override public void onBindViewHolder(final MyRecyclerHolder holder, final int position) { // 为ViewHolder的父控件(也即一条Item)设置高度 ViewGroup.LayoutParams lp = holder.itemView.getLayoutParams(); lp.height = mHeights.get(position); holder.itemView.setLayoutParams(lp); holder.mIvItem.setImageResource(R.mipmap.ic_launcher); String url = mList.get(position).newsIconUrl; holder.mIvItem.setTag(url); mImgLoader.showImgByAysncTask(holder.mIvItem, url); holder.mTvItem.setText(mList.get(position).newsTitle); // 调用条目的点击事件设置方法 setUpItemEvent(holder); // zz 测试 System.out.println("====onBindViewHolder : " + position + " == " + holder); } /** * 设置条目的点击事件(点按) * @param holder holder */ protected void setUpItemEvent(final MyRecyclerHolder holder) { if (mOnItemClickListener != null) { holder.itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { int layoutPosition = holder.getLayoutPosition(); mOnItemClickListener.onItemClick(holder.itemView, layoutPosition); } }); } } /** * RecyclerView的ViewHolder类 */ public class MyRecyclerHolder extends RecyclerView.ViewHolder { ImageView mIvItem; TextView mTvItem; public MyRecyclerHolder(View itemView) { super(itemView); mIvItem = (ImageView) itemView.findViewById(R.id.id_image); mTvItem = (TextView) itemView.findViewById(R.id.id_name); } } }
sonarqube.bat启动后自动关闭
第一次启动成功后再启动总是自动关闭,查看日志: --> Wrapper Started as Console Launching a JVM... Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org Copyright 1999-2006 Tanuki Software, Inc. All Rights Reserved. 2019.09.07 11:24:07 INFO app[][o.s.a.AppFileSystem] Cleaning or creating temp directory D:\sonarqube-7.9.1\temp 2019.09.07 11:24:07 INFO app[][o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001 2019.09.07 11:24:07 INFO app[][o.s.a.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [D:\sonarqube-7.9.1\elasticsearch]: C:\Program Files\Java\jdk-12.0.2\bin\java -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -Des.networkaddress.cache.ttl=60 -Des.networkaddress.cache.negative.ttl=10 -XX:+AlwaysPreTouch -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -XX:-OmitStackTraceInFastThrow -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dio.netty.recycler.maxCapacityPerThread=0 -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -Djava.io.tmpdir=D:\sonarqube-7.9.1\temp -XX:ErrorFile=../logs/es_hs_err_pid%p.log -Xms512m -Xmx512m -XX:+HeapDumpOnOutOfMemoryError -Delasticsearch -Des.path.home=D:\sonarqube-7.9.1\elasticsearch -Des.path.conf=D:\sonarqube-7.9.1\temp\conf\es -cp lib/* org.elasticsearch.bootstrap.Elasticsearch 2019.09.07 11:24:07 INFO app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running Java HotSpot(TM) 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release. 2019.09.07 11:24:09 INFO app[][o.e.p.PluginsService] no modules loaded 2019.09.07 11:24:09 INFO app[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin] 2019.09.07 11:24:16 WARN app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [es]: 1 2019.09.07 11:24:16 INFO app[][o.s.a.SchedulerImpl] Process[es] is stopped 2019.09.07 11:24:16 INFO app[][o.s.a.SchedulerImpl] SonarQube is stopped 2019.09.07 11:24:18 INFO app[][o.e.c.t.TransportClientNodesService] failed to get node info for {#transport#-1}{aLKfR7rmRFeznv4oZK4TVg}{127.0.0.1}{127.0.0.1:9001}, disconnecting... java.lang.IllegalStateException: Future got interrupted at org.elasticsearch.common.util.concurrent.FutureUtils.get(FutureUtils.java:60) at org.elasticsearch.action.support.AdapterActionFuture.actionGet(AdapterActionFuture.java:34) at org.elasticsearch.transport.ConnectionManager.internalOpenConnection(ConnectionManager.java:209) at org.elasticsearch.transport.ConnectionManager.openConnection(ConnectionManager.java:80) at org.elasticsearch.transport.TransportService.openConnection(TransportService.java:367) at org.elasticsearch.client.transport.TransportClientNodesService$SimpleNodeSampler.doSample(TransportClientNodesService.java:411) at org.elasticsearch.client.transport.TransportClientNodesService$NodeSampler.sample(TransportClientNodesService.java:362) at org.elasticsearch.client.transport.TransportClientNodesService.addTransportAddresses(TransportClientNodesService.java:201) at org.elasticsearch.client.transport.TransportClient.addTransportAddress(TransportClient.java:342) at org.sonar.application.es.EsConnectorImpl$MinimalTransportClient.<init>(EsConnectorImpl.java:108) at org.sonar.application.es.EsConnectorImpl.buildTransportClient(EsConnectorImpl.java:89) at org.sonar.application.es.EsConnectorImpl.getTransportClient(EsConnectorImpl.java:74) at org.sonar.application.es.EsConnectorImpl.getClusterHealthStatus(EsConnectorImpl.java:61) at org.sonar.application.process.EsManagedProcess.checkStatus(EsManagedProcess.java:88) at org.sonar.application.process.EsManagedProcess.checkOperational(EsManagedProcess.java:73) at org.sonar.application.process.EsManagedProcess.isOperational(EsManagedProcess.java:58) at org.sonar.application.process.ManagedProcessHandler.refreshState(ManagedProcessHandler.java:201) at org.sonar.application.process.ManagedProcessHandler$EventWatcher.run(ManagedProcessHandler.java:258) Caused by: java.lang.InterruptedException: null at java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1343) at org.elasticsearch.common.util.concurrent.BaseFuture$Sync.get(BaseFuture.java:251) at org.elasticsearch.common.util.concurrent.BaseFuture.get(BaseFuture.java:94) at org.elasticsearch.common.util.concurrent.FutureUtils.get(FutureUtils.java:57) ... 17 common frames omitted 请问是什么原因呢?
帮忙看看这个android错误 !
E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.lenovo.push, PID: 17578 java.lang.NullPointerException: Attempt to write to field 'int android.support.v7.widget.RecyclerView$ViewHolder.mItemViewType' on a null object reference at android.support.v7.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:6368) at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5555) at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5440) at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5436) at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2224) at android.support.v7.widget.GridLayoutManager.layoutChunk(GridLayoutManager.java:556) at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1511) at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:595) at android.support.v7.widget.GridLayoutManager.onLayoutChildren(GridLayoutManager.java:170) at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3583) at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:3312) at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3844) at android.view.View.layout(View.java:18799) at android.view.ViewGroup.layout(ViewGroup.java:5952) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323) at android.widget.FrameLayout.onLayout(FrameLayout.java:261) at android.view.View.layout(View.java:18799) at android.view.ViewGroup.layout(ViewGroup.java:5952) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323) at android.widget.FrameLayout.onLayout(FrameLayout.java:261) at android.view.View.layout(View.java:18799) at android.view.ViewGroup.layout(ViewGroup.java:5952) at android.support.design.widget.HeaderScrollingViewBehavior.layoutChild(HeaderScrollingViewBehavior.java:131) at android.support.design.widget.ViewOffsetBehavior.onLayoutChild(ViewOffsetBehavior.java:42) at android.support.design.widget.AppBarLayout$ScrollingViewBehavior.onLayoutChild(AppBarLayout.java:1391) at android.support.design.widget.CoordinatorLayout.onLayout(CoordinatorLayout.java:870) at android.view.View.layout(View.java:18799) at android.view.ViewGroup.layout(ViewGroup.java:5952) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323) at android.widget.FrameLayout.onLayout(FrameLayout.java:261) at android.view.View.layout(View.java:18799) at android.view.ViewGroup.layout(ViewGroup.java:5952) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1741) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1585) at android.widget.LinearLayout.onLayout(LinearLayout.java:1494) at android.view.View.layout(View.java:18799) at android.view.ViewGroup.layout(ViewGroup.java:5952) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323) at android.widget.FrameLayout.onLayout(FrameLayout.java:261) at android.view.View.layout(View.java:18799) at android.view.ViewGroup.layout(ViewGroup.java:5952) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1741) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1585) at android.widget.LinearLayout.onLayout(LinearLayout.java:1494) at android.view.View.layout(View.java:18799) at android.view.ViewGroup.layout(ViewGroup.java:5952) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323) at android.widget.FrameLayout.onLayout(FrameLayout.java:261) at com.android.internal.policy.DecorView.onLayout(DecorView.java:822) at android.view.View.layout(View.java:18799) at android.view.ViewGroup.layout(ViewGroup.java:5952) at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2627) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2343) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1502) E/AndroidRuntime: at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7044) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:927) at android.view.Choreographer.doCallbacks(Choreographer.java:702) at android.view.Choreographer.doFrame(Choreographer.java:638) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:913) at android.os.Handler.handleCallback(Handler.java:751) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6692) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358) Application terminated.
GridLayout动态添加子组件.layout_width和layout_height不起做用.
<GridLayout android:id="@+id/recycler_container" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingLeft="@dimen/dimen_2X" android:paddingRight="@dimen/dimen_2X" android:columnCount="5" ></GridLayout> gridLayout.post(new Runnable() { @Override public void run() { int width = (gridLayout.getWidth() - 2 * gridLayout.getPaddingLeft()) / COLUMNCOUNT; int height = (int) (width / 0.75f); MyLogger.jLog().i(width + ":" + height); for (int i = 0; i < FAVORITCOUNT; i++) { TextView colorCardView = new TextView(getApplicationContext()); colorCardView.setBackgroundColor(Color.WHITE ); GridLayout.LayoutParams layoutParams = new GridLayout.LayoutParams(); layoutParams.width = width; layoutParams.height = height; colorCardView.setLayoutParams(layoutParams); gridLayout.addView(colorCardView); } } }); 需求是在Gridlayout中显示25个子组件.每行5个.每个组件宽高比是3:4. 在log中已经能获取到宽高98,130. 但实际显示中,子组件的宽为父布局宽,高为宽的4/3.所有子组件重叠在一起. 感觉params.width和height完全没起作用.
windows7中ACPI fixed feature button 的问题
电脑好像中毒了。就是在别人的服务器或虚拟磁盘里运行。以下只提供些文件信息。同时手机也应该同电脑一样有问题的,。 我不清楚具体是什么情况, 希望来位大神帮帮解决方法。 当然有什么要求可以同本人商量。 联系QQ78957787 手机15259903353 ACPI fixed feature button Microsoft 控制台 工作组WORKGROUP windows7 sevvice pack1 型号:Ghost-win7-sp1 激活:ID 00426-OEM-892662-00006 Manag ement console 3.0 Realtek PCIE FE Family contvolle 桌面%localAPP Data% Realtek High Definition Audio Microsoft NET Framework4.5.3 (0.99GB大小) 末知账户(S-1-5-21-422126~~625-129988599-3143416188-1000) 地址:C:\Program Data\microsoft\widows\stavtmenu\programs\Accessories F:%APPNATA% Recycler $RECYCLE.BIN system volume E:$RECYCLE.BIN 360cloudui 360Down loads 4f6dc9042d510d1 MSXML.4.0 SP3 Parser(KB2758694)
Android程序编译错误,求指点
MainActivity ``` package uibestpractice.example.com.uibestpractice; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.View; import android.widget.Button; import android.widget.EditText; import java.util.ArrayList; import java.util.List; public class MainActivity extends AppCompatActivity { private List<Msg> msgList = new ArrayList<Msg>(); private EditText inputText; private Button send; private RecyclerView msgRecyclerView; private MsgAdapter adapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); initMsgs(); inputText = (EditText) findViewById(R.id.input_text); send = (Button) findViewById(R.id.send); msgRecyclerView = (RecyclerView) findViewById(R.id.msg_recycler_view); LinearLayoutManager layoutManager = new LinearLayoutManager(this); msgRecyclerView.setLayoutManager(layoutManager); adapter = new MsgAdapter(msgList); msgRecyclerView.setAdapter(adapter); send.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String content = inputText.getText().toString(); if (!"".equals(content)) { Msg msg = new Msg(content, Msg.TYPE_SENT); msgList.add(msg); adapter.notifyItemInserted(msgList.size() - 1); // 当有新消息时,刷新ListView中的显示 msgRecyclerView.scrollToPosition(msgList.size() - 1); // 将ListView定位到最后一行 inputText.setText(""); // 清空输入框中的内容 } } }); } private void initMsgs() { Msg msg1 = new Msg("Hello guy.", Msg.TYPE_RECEIVED); msgList.add(msg1); Msg msg2 = new Msg("Hello. Who is that?", Msg.TYPE_SENT); msgList.add(msg2); Msg msg3 = new Msg("This is Tom. Nice talking to you. ", Msg.TYPE_RECEIVED); msgList.add(msg3); } } ``` Msg ``` package uibestpractice.example.com.uibestpractice; /** * Created by toudou on 2017/3/10. */ public class Msg { // 两个静态常量用于控制左右视图的隐藏 public static final int TYPE_RECEIVED = 0; public static final int TYPE_SENT = 1; private String content; private int type; public Msg(String content, int type) { this.content = content; this.type = type; } public String getContent() { return content; } public int getType() { return type; } } ``` MsgAdapter ``` package uibestpractice.example.com.uibestpractice; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.LinearLayout; import android.widget.TextView; import java.util.List; /** * Created by toudou on 2017/3/10. */ public class MsgAdapter extends RecyclerView.Adapter<MsgAdapter.ViewHolder> { private List<Msg> mMsgList; static class ViewHolder extends RecyclerView.ViewHolder { LinearLayout leftLayout; LinearLayout rightLayout; TextView leftMsg; TextView rightMsg; public ViewHolder(View itemView) { super(itemView); leftLayout = (LinearLayout) itemView.findViewById(R.id.left_layout); rightLayout = (LinearLayout) itemView.findViewById(R.id.right_layout); leftMsg = (TextView) itemView.findViewById(R.id.left_msg); rightMsg = (TextView) itemView.findViewById(R.id.right_msg); } } public MsgAdapter(List<Msg> msgList) { mMsgList = msgList; } @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { // View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.msg_item, parent, null); View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.msg_item, parent, false); return new ViewHolder(view); } @Override public void onBindViewHolder(ViewHolder holder, int position) { Msg msg = mMsgList.get(position); if (msg.getType() == Msg.TYPE_RECEIVED) { // 如果是收到的消息,则显示左边的消息布局,将右边的消息布局隐藏 holder.leftLayout.setVisibility(View.VISIBLE); holder.rightLayout.setVisibility(View.GONE); holder.leftMsg.setText(msg.getContent()); } else if (msg.getType() == Msg.TYPE_SENT) { // 如果是发出的消息,则显示右边的消息布局,将左边的消息布局隐藏 holder.rightLayout.setVisibility(View.VISIBLE); holder.leftLayout.setVisibility(View.GONE); holder.rightMsg.setText(msg.getContent()); } } public int getItemCount() { return mMsgList.size(); } } ``` activity_main.xml ``` <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#d8e0e8" > <android.support.v7.widget.RecyclerView android:id="@+id/msg_recycler_view" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" /> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" > <EditText android:id="@+id/input_text" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:hint="Type something here" android:maxLines="2" /> <Button android:id="@+id/send" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Send" /> </LinearLayout> </LinearLayout> ``` msg_item.xml ``` <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="10dp" > <LinearLayout android:id="@+id/left_layout" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="left" android:background="@drawable/message_left" > <TextView android:id="@+id/left_msg" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_margin="10dp" android:textColor="#fff" /> </LinearLayout> <LinearLayout android:id="@+id/right_layout" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="right" android:background="@drawable/message_right" > <TextView android:id="@+id/right_msg" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_margin="10dp" /> </LinearLayout> </LinearLayout> ``` 报错:Error:Some file crunching failed, see logs for details Error:Execution failed for task ':app:mergeDebugResources'. > Error: Some file crunching failed, see logs for details 03-15 13:52:24.347 11475-11475/? I/Atfwd_Daemon: result : -1 ,Init step :2 ,qmiErrorCode: 0 03-15 13:52:24.707 20505-21107/? D/PatchUpdateManager: deletePatch deletePatch is close ,may be a error 03-15 13:53:45.107 3803-5647/? E/audio_a2dp_hw: adev_set_parameters: ERROR: set param called even when stream out is null 03-15 13:53:49.307 3803-5647/? E/audio_a2dp_hw: adev_set_parameters: ERROR: set param called even when stream out is null 03-15 13:54:14.367 11475-11475/? I/Atfwd_Daemon: result : -1 ,Init step :2 ,qmiErrorCode: 0 03-15 13:56:09.387 11475-11475/? I/Atfwd_Daemon: result : -1 ,Init step :2 ,qmiErrorCode: 0 03-15 13:56:52.437 13980-13980/? W/ResourceType: Failure getting entry for 0x7f0c047a (t=11 e=1146) (error -75) 03-15 13:57:07.467 14123-14123/? W/ResourceType: Failure getting entry for 0x7f0c047a (t=11 e=1146) (error -75) 03-15 13:58:09.407 11475-11475/? I/Atfwd_Daemon: result : -1 ,Init step :2 ,qmiErrorCode: 0 03-15 13:58:34.417 593-593/? E/QC-QMI: qmuxd: RX on fd=25 returned error=0 errno[2:No such file or directory] 03-15 13:58:34.447 14451-14451/? I/Atfwd_Daemon: result : 255 ,Init step :0 ,qmiErrorCode: 0 03-15 13:58:34.447 14451-14451/? I/Atfwd_Daemon: result : 0 ,Init step :1 ,qmiErrorCode: 0 03-15 14:00:14.477 14451-14451/? I/Atfwd_Daemon: result : -1 ,Init step :2 ,qmiErrorCode: 0 03-15 14:01:59.497 14451-14451/? I/Atfwd_Daemon: result : -1 ,Init step :2 ,qmiErrorCode: 0
sonar 配置mysql 连接报错
sonar 版本 6.7 mysql 版本 8.0 配置:sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance&useSSL=false sonar.jdbc.username=easy sonar.jdbc.password=nolove 错误信息:11:30:57.509 [WrapperSimpleAppMain] WARN org.sonar.application.config.JdbcSettings - JDBC URL is recommended to have the property 'useConfigs=maxPerformance' 2018.09.04 11:30:57 INFO app[][o.s.a.AppFileSystem] Cleaning or creating temp directory F:\service\sonarqube-6.7.4\temp 2018.09.04 11:30:57 INFO app[][o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001 2018.09.04 11:30:57 INFO app[][o.s.a.p.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [F:\service\sonarqube-6.7.4\elasticsearch]: F:\service\jdk1.8\jre\bin\java -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+AlwaysPreTouch -server -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -Djdk.io.permissionsUseCanonicalPath=true -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dio.netty.recycler.maxCapacityPerThread=0 -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -Dlog4j.skipJansi=true -Xms512m -Xmx512m -XX:+HeapDumpOnOutOfMemoryError -Delasticsearch -Des.path.home=F:\service\sonarqube-6.7.4\elasticsearch -cp lib/* org.elasticsearch.bootstrap.Elasticsearch -Epath.conf=F:\service\sonarqube-6.7.4\temp\conf\es 2018.09.04 11:30:57 INFO app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running 2018.09.04 11:30:57 INFO app[][o.e.p.PluginsService] no modules loaded 2018.09.04 11:30:57 INFO app[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin] 2018.09.04 11:31:05 INFO app[][o.s.a.SchedulerImpl] Process[es] is up 2018.09.04 11:31:05 INFO app[][o.s.a.p.ProcessLauncherImpl] Launch process[[key='web', ipcIndex=2, logFilenamePrefix=web]] from [F:\service\sonarqube-6.7.4]: F:\service\jdk1.8\jre\bin\java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djava.io.tmpdir=F:\service\sonarqube-6.7.4\temp -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -cp ./lib/common/*;./lib/server/*;F:\service\sonarqube-6.7.4\lib\jdbc\mysql\mysql-connector-java-5.1.42.jar org.sonar.server.app.WebServer F:\service\sonarqube-6.7.4\temp\sq-process1179029085093446759properties Tue Sep 04 11:31:08 AWST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification. 2018.09.04 11:31:09 INFO app[][o.s.a.SchedulerImpl] Process [web] is stopped 2018.09.04 11:31:09 INFO app[][o.s.a.SchedulerImpl] Process [es] is stopped 2018.09.04 11:31:09 INFO app[][o.s.a.SchedulerImpl] SonarQube is stopped 2018.09.04 11:31:09 WARN app[][o.e.t.n.Netty4Transport] exception caught on transport layer [[id: 0xadc1a015, L:/127.0.0.1:53287 - R:/127.0.0.1:9001]], closing connection java.io.IOException: 远程主机强迫关闭了一个现有的连接。
Java学习的正确打开方式
在博主认为,对于入门级学习java的最佳学习方法莫过于视频+博客+书籍+总结,前三者博主将淋漓尽致地挥毫于这篇博客文章中,至于总结在于个人,实际上越到后面你会发现学习的最好方式就是阅读参考官方文档其次就是国内的书籍,博客次之,这又是一个层次了,这里暂时不提后面再谈。博主将为各位入门java保驾护航,各位只管冲鸭!!!上天是公平的,只要不辜负时间,时间自然不会辜负你。 何谓学习?博主所理解的学习,它是一个过程,是一个不断累积、不断沉淀、不断总结、善于传达自己的个人见解以及乐于分享的过程。
大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了
大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...
linux系列之常用运维命令整理笔录
本博客记录工作中需要的linux运维命令,大学时候开始接触linux,会一些基本操作,可是都没有整理起来,加上是做开发,不做运维,有些命令忘记了,所以现在整理成博客,当然vi,文件操作等就不介绍了,慢慢积累一些其它拓展的命令,博客不定时更新 free -m 其中:m表示兆,也可以用g,注意都要小写 Men:表示物理内存统计 total:表示物理内存总数(total=used+free) use...
Vue + Spring Boot 项目实战(十四):用户认证方案与完善的访问拦截
本篇文章主要讲解 token、session 等用户认证方案的区别并分析常见误区,以及如何通过前后端的配合实现完善的访问拦截,为下一步权限控制的实现打下基础。
比特币原理详解
一、什么是比特币 比特币是一种电子货币,是一种基于密码学的货币,在2008年11月1日由中本聪发表比特币白皮书,文中提出了一种去中心化的电子记账系统,我们平时的电子现金是银行来记账,因为银行的背后是国家信用。去中心化电子记账系统是参与者共同记账。比特币可以防止主权危机、信用风险。其好处不多做赘述,这一层面介绍的文章很多,本文主要从更深层的技术原理角度进行介绍。 二、问题引入 假设现有4个人...
程序员接私活怎样防止做完了不给钱?
首先跟大家说明一点,我们做 IT 类的外包开发,是非标品开发,所以很有可能在开发过程中会有这样那样的需求修改,而这种需求修改很容易造成扯皮,进而影响到费用支付,甚至出现做完了项目收不到钱的情况。 那么,怎么保证自己的薪酬安全呢? 我们在开工前,一定要做好一些证据方面的准备(也就是“讨薪”的理论依据),这其中最重要的就是需求文档和验收标准。一定要让需求方提供这两个文档资料作为开发的基础。之后开发...
网页实现一个简单的音乐播放器(大佬别看。(⊙﹏⊙))
今天闲着无事,就想写点东西。然后听了下歌,就打算写个播放器。 于是乎用h5 audio的加上js简单的播放器完工了。 演示地点演示 html代码如下` music 这个年纪 七月的风 音乐 ` 然后就是css`*{ margin: 0; padding: 0; text-decoration: none; list-...
Python十大装B语法
Python 是一种代表简单思想的语言,其语法相对简单,很容易上手。不过,如果就此小视 Python 语法的精妙和深邃,那就大错特错了。本文精心筛选了最能展现 Python 语法之精妙的十个知识点,并附上详细的实例代码。如能在实战中融会贯通、灵活使用,必将使代码更为精炼、高效,同时也会极大提升代码B格,使之看上去更老练,读起来更优雅。
数据库优化 - SQL优化
以实际SQL入手,带你一步一步走上SQL优化之路!
2019年11月中国大陆编程语言排行榜
2019年11月2日,我统计了某招聘网站,获得有效程序员招聘数据9万条。针对招聘信息,提取编程语言关键字,并统计如下: 编程语言比例 rank pl_ percentage 1 java 33.62% 2 cpp 16.42% 3 c_sharp 12.82% 4 javascript 12.31% 5 python 7.93% 6 go 7.25% 7 p...
通俗易懂地给女朋友讲:线程池的内部原理
餐盘在灯光的照耀下格外晶莹洁白,女朋友拿起红酒杯轻轻地抿了一小口,对我说:“经常听你说线程池,到底线程池到底是个什么原理?”
经典算法(5)杨辉三角
杨辉三角 是经典算法,这篇博客对它的算法思想进行了讲解,并有完整的代码实现。
腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹?
昨天,有网友私信我,说去阿里面试,彻底的被打击到了。问了为什么网上大量使用ThreadLocal的源码都会加上private static?他被难住了,因为他从来都没有考虑过这个问题。无独有偶,今天笔者又发现有网友吐槽了一道腾讯的面试题,我们一起来看看。 腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹? 在互联网职场论坛,一名程序员发帖求助到。二面腾讯,其中一个算法题:64匹...
面试官:你连RESTful都不知道我怎么敢要你?
干货,2019 RESTful最贱实践
SQL-小白最佳入门sql查询一
不要偷偷的查询我的个人资料,即使你再喜欢我,也不要这样,真的不好;
项目中的if else太多了,该怎么重构?
介绍 最近跟着公司的大佬开发了一款IM系统,类似QQ和微信哈,就是聊天软件。我们有一部分业务逻辑是这样的 if (msgType = "文本") { // dosomething } else if(msgType = "图片") { // doshomething } else if(msgType = "视频") { // doshomething } else { // doshom...
漫话:什么是平衡(AVL)树?这应该是把AVL树讲的最好的文章了
这篇文章通过对话的形式,由浅入深带你读懂 AVL 树,看完让你保证理解 AVL 树的各种操作,如果觉得不错,别吝啬你的赞哦。 1、若它的左子树不为空,则左子树上所有的节点值都小于它的根节点值。 2、若它的右子树不为空,则右子树上所有的节点值均大于它的根节点值。 3、它的左右子树也分别可以充当为二叉查找树。 例如: 例如,我现在想要查找数值为14的节点。由于二叉查找树的特性,我们可...
“狗屁不通文章生成器”登顶GitHub热榜,分分钟写出万字形式主义大作
一、垃圾文字生成器介绍 最近在浏览GitHub的时候,发现了这样一个骨骼清奇的雷人项目,而且热度还特别高。 项目中文名:狗屁不通文章生成器 项目英文名:BullshitGenerator 根据作者的介绍,他是偶尔需要一些中文文字用于GUI开发时测试文本渲染,因此开发了这个废话生成器。但由于生成的废话实在是太过富于哲理,所以最近已经被小伙伴们给玩坏了。 他的文风可能是这样的: 你发现,...
程序员:我终于知道post和get的区别
是一个老生常谈的话题,然而随着不断的学习,对于以前的认识有很多误区,所以还是需要不断地总结的,学而时习之,不亦说乎
《程序人生》系列-这个程序员只用了20行代码就拿了冠军
你知道的越多,你不知道的越多 点赞再看,养成习惯GitHub上已经开源https://github.com/JavaFamily,有一线大厂面试点脑图,欢迎Star和完善 前言 这一期不算《吊打面试官》系列的,所有没前言我直接开始。 絮叨 本来应该是没有这期的,看过我上期的小伙伴应该是知道的嘛,双十一比较忙嘛,要值班又要去帮忙拍摄年会的视频素材,还得搞个程序员一天的Vlog,还要写BU...
开源并不是你认为的那些事
点击上方蓝字 关注我们开源之道导读所以 ————想要理清开源是什么?先要厘清开源不是什么,名正言顺是句中国的古代成语,概念本身的理解非常之重要。大部分生物多样性的起源,...
加快推动区块链技术和产业创新发展,2019可信区块链峰会在京召开
11月8日,由中国信息通信研究院、中国通信标准化协会、中国互联网协会、可信区块链推进计划联合主办,科技行者协办的2019可信区块链峰会将在北京悠唐皇冠假日酒店开幕。   区块链技术被认为是继蒸汽机、电力、互联网之后,下一代颠覆性的核心技术。如果说蒸汽机释放了人类的生产力,电力解决了人类基本的生活需求,互联网彻底改变了信息传递的方式,区块链作为构造信任的技术有重要的价值。   1...
程序员把地府后台管理系统做出来了,还有3.0版本!12月7号最新消息:已在开发中有github地址
第一幕:缘起 听说阎王爷要做个生死簿后台管理系统,我们派去了一个程序员…… 996程序员做的梦: 第一场:团队招募 为了应对地府管理危机,阎王打算找“人”开发一套地府后台管理系统,于是就在地府总经办群中发了项目需求。 话说还是中国电信的信号好,地府都是满格,哈哈!!! 经常会有外行朋友问:看某网站做的不错,功能也简单,你帮忙做一下? 而这次,面对这样的需求,这个程序员...
网易云6亿用户音乐推荐算法
网易云音乐是音乐爱好者的集聚地,云音乐推荐系统致力于通过 AI 算法的落地,实现用户千人千面的个性化推荐,为用户带来不一样的听歌体验。 本次分享重点介绍 AI 算法在音乐推荐中的应用实践,以及在算法落地过程中遇到的挑战和解决方案。 将从如下两个部分展开: AI算法在音乐推荐中的应用 音乐场景下的 AI 思考 从 2013 年 4 月正式上线至今,网易云音乐平台持续提供着:乐屏社区、UGC...
【技巧总结】位运算装逼指南
位算法的效率有多快我就不说,不信你可以去用 10 亿个数据模拟一下,今天给大家讲一讲位运算的一些经典例子。不过,最重要的不是看懂了这些例子就好,而是要在以后多去运用位运算这些技巧,当然,采用位运算,也是可以装逼的,不信,你往下看。我会从最简单的讲起,一道比一道难度递增,不过居然是讲技巧,那么也不会太难,相信你分分钟看懂。 判断奇偶数 判断一个数是基于还是偶数,相信很多人都做过,一般的做法的代码如下...
《C++ Primer》学习笔记(六):C++模块设计——函数
专栏C++学习笔记 《C++ Primer》学习笔记/习题答案 总目录 https://blog.csdn.net/TeFuirnever/article/details/100700212 —————————————————————————————————————————————————————— 《C++ Primer》习题参考答案:第6章 - C++模块设计——函数 文章目录专栏C+...
8年经验面试官详解 Java 面试秘诀
作者 |胡书敏 责编 | 刘静 出品 | CSDN(ID:CSDNnews) 本人目前在一家知名外企担任架构师,而且最近八年来,在多家外企和互联网公司担任Java技术面试官,前后累计面试了有两三百位候选人。在本文里,就将结合本人的面试经验,针对Java初学者、Java初级开发和Java开发,给出若干准备简历和准备面试的建议。 Java程序员准备和投递简历的实...
面试官如何考察你的思维方式?
1.两种思维方式在求职面试中,经常会考察这种问题:北京有多少量特斯拉汽车?某胡同口的煎饼摊一年能卖出多少个煎饼?深圳有多少个产品经理?一辆公交车里能装下多少个乒乓球?一个正常成年人有多少根头发?这类估算问题,被称为费米问题,是以科学家费米命名的。为什么面试会问这种问题呢?这类问题能把两类人清楚地区分出来。一类是具有文科思维的人,擅长赞叹和模糊想象,它主要依靠的是人的第一反应和直觉,比如小孩...
so easy! 10行代码写个"狗屁不通"文章生成器
前几天,GitHub 有个开源项目特别火,只要输入标题就可以生成一篇长长的文章。 背后实现代码一定很复杂吧,里面一定有很多高深莫测的机器学习等复杂算法 不过,当我看了源代码之后 这程序不到50行 尽管我有多年的Python经验,但我竟然一时也没有看懂 当然啦,原作者也说了,这个代码也是在无聊中诞生的,平时撸码是不写中文变量名的, 中文...
知乎高赞:中国有什么拿得出手的开源软件产品?(整理自本人原创回答)
知乎高赞:中国有什么拿得出手的开源软件产品? 在知乎上,有个问题问“中国有什么拿得出手的开源软件产品(在 GitHub 等社区受欢迎度较好的)?” 事实上,还不少呢~ 本人于2019.7.6进行了较为全面的回答,对这些受欢迎的 Github 开源项目分类整理如下: 分布式计算、云平台相关工具类 1.SkyWalking,作者吴晟、刘浩杨 等等 仓库地址: apache/skywalking 更...
相关热词 c# 图片上传 c# gdi 占用内存 c#中遍历字典 c#控制台模拟dos c# 斜率 最小二乘法 c#进程延迟 c# mysql完整项目 c# grid 总行数 c# web浏览器插件 c# xml 生成xsd
立即提问