Nhờ dextor câu trả lời, tôi có thể tìm ra câu trả lời này.
Tôi đã sử dụng FocusChangeListener
và thêm trạng thái hoạt hình để thay đổi kích thước của quan điểm:
static class ViewHolder extends RecyclerView.ViewHolder {
public ViewHolder(final View root) {
// bind views
// ...
// bind focus listener
root.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (hasFocus) {
// run scale animation and make it bigger
Animation anim = AnimationUtils.loadAnimation(context, R.anim.scale_in_tv);
root.startAnimation(anim);
anim.setFillAfter(true);
} else {
// run scale animation and make it smaller
Animation anim = AnimationUtils.loadAnimation(context, R.anim.scale_out_tv);
root.startAnimation(anim);
anim.setFillAfter(true);
}
}
});
}
Và mã cho anims:
scale_in_tv:
<scale xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="300"
android:fromXScale="100%"
android:fromYScale="100%"
android:toXScale="110%"
android:toYScale="110%"
android:pivotX="50%"
android:pivotY="50%">
</scale>
scale_out_tv :
<scale xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="100"
android:fromXScale="110%"
android:fromYScale="110%"
android:toXScale="100%"
android:toYScale="100%"
android:pivotX="50%"
android:pivotY="50%">
</scale>
Tôi làm chính xác như vậy. nhưng không ảnh hưởng đến 'RecyclerList' của tôi. Tôi có một cái nhìn hình ảnh trên người giữ quan điểm của tôi và tôi muốn lớn hơn khi tập trung. Giúp tôi! –
Xin chào @SadeqShajary, có thể bạn nên áp dụng focusChangeListener vào chế độ xem gốc thay vì chính imageView. Điều này đã được phát triển và thử nghiệm trên Android TV, sử dụng điều khiển từ xa. – Skycorsarius
Vui lòng không chỉnh sửa giải pháp thành câu hỏi - bạn nên đăng giải pháp đó làm câu trả lời để nhất quán với định dạng Hỏi và Đáp của Stack Overflow. – EJoshuaS