2017-10-26 1 views
0

0 또는 1 또는 2 또는 5 개의 항목이 포함 된 ArrayList이 여러 개 있습니다. 이러한 항목을 사용자에게 표시해야합니다. 마녀 방식이 더 좋습니까? 프로그래밍 방식으로 TextView을 만들거나 쇼에 recyclerView을 사용합니까?항목 표시 동적 길이가있는 ArrayList

답변

1

recyclerView

프로의 몇 가지 장점과 단점이 있습니다

· integrated animations for adding, updating and removing items 
· enforces the recycling of views by using the ViewHolder pattern 
· supports both grids and lists 
· supports vertical and horizontal scrolling 

단점 : 당신이 경우

· adds complexity 

확인하십시오

· There won't be more then 5 elements ever in future 
· You don't need integrated animations for items 
· You don't need to edit each item in the list 
· You don't need to change the appearance of grid vs list dynamically 

그러면 RecyclerView을 사용하지 않는 것이 좋습니다. 복잡성이 추가되고 원하는대로 각 itemView을 가지고 놀 수 있습니다.

0

개까지 5 개의 요소는 스크롤 할 수 없습니다. 그래서 더 나은 textview을 만듭니다. 스크롤 한 화면 경우 현재 화면에 표시되는 메모리의 항목을 개최하기 때문에, 다음 recyclerview는 의미가됩니다

0

여분의 항목을 추가하려는 경우 리사이클러보기를 사용하는 항목이 5 개 뿐이라고 언급 했으므로 더 쉬울 것입니다.