@RahulSDeshpande hi
this is my layout file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<com.telemedicine_tv.widget.ScaleRecyclerView
android:id="@+id/rv_doctors"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
and this is my custom widget code:
public class ScaleRecyclerView extends RecyclerView {
private int mSelectedPosition = 0;
public ScaleRecyclerView(Context context) {
super(context);
init();
}
public ScaleRecyclerView(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
init();
}
public ScaleRecyclerView(Context context, @Nullable AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
init();
}
private void init() {
//启用子视图排序功能
setChildrenDrawingOrderEnabled(true);
}
@Override
public void onDraw(Canvas c) {
mSelectedPosition = getChildAdapterPosition(getFocusedChild());
super.onDraw(c);
}
@Override
protected int getChildDrawingOrder(int childCount, int i) {
int position = mSelectedPosition;
if (position < 0) {
return i;
} else {
if (i == childCount - 1) {
if (position > i) {
position = i;
}
return position;
}
if (i == position) {
return childCount - 1;
}
}
return i;
}
}
emm .. I don't use NestedScrollView
anywhere.
Any problem with my custom RecyclerView
?