片段中的Android Recycler和ButterKnitfe错误

时间:2017-04-13 08:03:46

标签: android android-recyclerview butterknife

  1. ButterKnife.bind(this)错误
  2. private void bindButterKnife() {
    
            ButterKnife.bind(this);
        }
    
    1. (这个,新的ArrayList())和(new LinearLayoutManager(this));错误
    2. private void setUserRecyclerView() {
          mUsersChatAdapter = new UsersChatAdapter(this, new ArrayList<User>());
          mUsersRecyclerView.setLayoutManager(new LinearLayoutManager(this));
          mUsersRecyclerView.setHasFixedSize(true);
          mUsersRecyclerView.setAdapter(mUsersChatAdapter);
      }
      
      某人帮助我了

1 个答案:

答案 0 :(得分:1)

  1. 覆盖<a title='Project 1'class="text1" onclick="showDiv('welcomeDiv1')">Project 1</a> <a title='Project 2' class="text1" onclick="showDiv('welcomeDiv2')">Project 2</a> <div class="websites"> <div id="welcomeDiv1" style="display:none;" class="answer_list" >1</div> <div id="welcomeDiv2" style="display:none;" class="answer_list" >2</div> </div> <script> function showDiv(div_id) { var divsToHide = document.getElementsByClassName("answer_list"); //divsToHide is an array for(var i = 0; i < divsToHide.length; i++){ divsToHide[i].style.display = "none"; // hide your divisions } document.getElementById(div_id).style.display = "block"; //show your division } </script> 并将ButterKnife用作onViewCreated
  2. 使用ButterKnife.bind(this, view)代替getActivity()

    this