我的下面的代码不适用于Android 4.x,我搜索更多有关该问题的解决方案,但我无法解决此问题
private void makeSelectable(ViewGroup viewGroup, final int mPosition, final int mIndexPosition) {
for (int i = 0; i < viewGroup.getChildCount(); i++) {
final View child = viewGroup.getChildAt(i);
if (child instanceof ViewGroup) {
makeSelectable((ViewGroup) child, mPosition, mIndexPosition);
} else if (child instanceof TextView) {
Log.e("FOUND ", " TEXTVIEW " + i);
((TextView) child).setGravity(Gravity.RIGHT);
((TextView) child).setTextIsSelectable(true);
((TextView) child).setTextSize(TypedValue.COMPLEX_UNIT_SP, textSize == 0 ? 14 : textSize);
child.setFocusable(true);
child.setFocusableInTouchMode(true);
((TextView) child).setMovementMethod(LinkMovementMethod.getInstance());
((TextView) child).setCustomSelectionActionModeCallback(new ActionMode.Callback() {
...
});
}
}
}