Drawable drawable = ContextCompat.getDrawable(getApplicationContext(),R.drawable.ic_arrow_back_white_24dp); Overflow 아이콘 변경 toolbar.setOverflowIcon(drawable); 햄버거 모양 아이콘 변경 actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowHomeEnabled(true); Drawable drawable = ContextCompat.getDrawable(mContext,R.drawable.ic_arrow_back_white_24dp); actionBar.setHomeAsUpIndicator(drawable); 액티비티..
ERROR: Failed to parse XML in /User/,,,,,,,,AndroidManifest.xmlParseError at [row,col]:[310,9]Message: expected start or end tagAffected Modules: app xml 경로가 길어서 끝까지 보지 못하는 경우가 있다.이 에러는 AndroidManifest 310 라인을 보시오. 주석이 혼자 놀고 있을 수 있으니. build.gradle 문제가 아니오.
findViewHolderForAdapterPosition 을 써서 holder 의 itemView를 얻어 올 수 있는 방법이 있다. 즉, 예전 listView의 경우 해당 아이템을 가져와서 크기를 측정(itemView.measure) 한 뒤 리스트의 상단에서 그 아이템 위치 까지 높이를 만들어서 갔었는데, reclyerView에서는 이런 작업을 할 경우, 리스트가 notifychanged 를 하면서 null 이 떨어 질 수 있다. null 을 피하기 위해선 많은 방법을 사용 해야 한다. LinearLayoutManager linearLayoutManager = (LinearLayoutManager)recyclerView.getLayoutManager(); if(linearLayoutManager != ..
프레그먼트 생명 주기 실행 시onAttach —> onCreate() —> onViewCreated() —> onActivicyCreated() —> onResume() 해제시onPause() — > onDestroyView() — > onDestroy() —> onDetach() 즉,안전하게 context 를 사용 하려면 @Override public void onAttach(Context context) { super.onAttach(context); mContext = context; } 요렇게 해서 사용한다.프래그먼트 이곳 저곳에서 getContext(), getActivity() 를 부르다가 Null 이 발생할 수 있기 때문에 이렇게 부르는 것이 안전. 더 안전 하려면 부를 때마다 체크 하는게 ..
아주 간단하다.아래 처럼 넣어 주면, 색깔까지 완벽하게! DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(mContext,LinearLayoutManager.VERTICAL); dividerItemDecoration.setDrawable(mContext.getResources().getDrawable(R.drawable.recyclerview_divider)); mRecyclerView.addItemDecoration(dividerItemDecoration);아래는 recyclerview_divider.xml
- Total
- 410,774
- Today
- 117
- Yesterday
- 252