2017-07-27 56 views
6

Tôi đang cố gắng làm cho cuộn RecyclerView mượt mà. Bắt đầu với việc phân tích dấu vết từ Android Device Monitor> DDMS> Android Systrace Tôi nghĩ rằng việc thêm các phần tùy chỉnh có thể hữu ích. Ở đây, bạn có thể tìm thấy ví dụ tôi sử dụng để thực hiện điều này. Ai đó có thể xin vui lòng chỉ cho tôi nơi có thể tìm thấy các bản ghi phần tôi đã thêm vào? Cảm ơn.Dấu vết hệ thống Android [dấu đánh dấu]

@Override 
public CalendarMatchViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { 
    //  calendar_match_item calendar_match_item 
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { 
     Trace.beginSection("onCreateViewHolder"); 
    } 
    View view = mInflater.inflate(R.layout.calendar_match_item, parent, false); 
    CalendarMatchViewHolder vh = new CalendarMatchViewHolder(view); 
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { 
     Trace.endSection(); 
    } 
    return vh; 
} 

@Override 
public void onBindViewHolder(CalendarMatchViewHolder holder, int position) { 
    Match match = mMatches.get(position); 
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { 
     Trace.beginSection("onBindViewHolder"); 
    } 
    setOtherMatchesBasicData(match, holder); 
    setOfferLayout(match, holder); 

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { 
     Trace.endSection(); 
    } 
} 

Trả lời

3

Bạn có thể thực hiện việc này bằng cách chọn tên gói trong cửa sổ Systrace từ trình đơn thả xuống "Enter Application Traces From".

Bạn có thể tìm thêm về Systrace và làm thế nào để sử dụng nó trên liên kết này: https://developer.android.com/studio/profile/systrace.html

Systrace window

Các vấn đề liên quan