When Bottom sheet is open(First image below) and When tab on editText , the keyboard hides the edit text(Second image below) , i want to move keyword below the "ADD" botton of bottomsheet.How to do this?
Image 2:
Fragment
public class CustomExerciseFragment extends BaseCardFragment {
private View parent_view;
private RecyclerView recyclerView;
private AdapterEasyListAnimation mAdapter;
private LinkedList<DaysDetails> items = new LinkedList<>();
private int animation_type = ItemAnimation.BOTTOM_UP;
private DaysDAO daysDAO;
private ExercisesDAO exercisesDAO;
private ImageView imageView;
private Button buttonBreif;
//=========Configure this at the beginning=============
private final String routineId="1520";
private final String legWorkoutImageName="leg_workout_customize";
private BottomSheetBehavior mBehavior;
private BottomSheetDialog mBottomSheetDialog;
private View bottom_sheet;
public static CustomExerciseFragment newInstance() {
CustomExerciseFragment fragment = new CustomExerciseFragment();
return fragment;
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
View root = inflater.inflate(R.layout.fragment_custom_exercise, container, false);
mCardView = (CardView) root.findViewById(R.id.cardView);
mCardView.setMaxCardElevation(mCardView.getCardElevation()
* CardAdapter.MAX_ELEVATION_FACTOR);
bottom_sheet = root.findViewById(R.id.bottom_sheet_add_days);
mBehavior = BottomSheetBehavior.from(bottom_sheet);
mBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
((ExtendedFloatingActionButton) root.findViewById(R.id.extended_fab)).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showAddDaysBottomSheetDialog();
}
});
return root;
}
private void showAddDaysBottomSheetDialog() {
if (mBehavior.getState() == BottomSheetBehavior.STATE_EXPANDED) {
mBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
}
final View view = getLayoutInflater().inflate(R.layout.sheet_add_days, null);
mBottomSheetDialog = new BottomSheetDialog(getContext());
mBottomSheetDialog.setContentView(view);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
mBottomSheetDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
mBottomSheetDialog.show();
mBottomSheetDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
mBottomSheetDialog = null;
}
});
}
}
BottomSheetLayout
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
android:fitsSystemWindows="true"
android:orientation="vertical">
<androidx.core.widget.NestedScrollView
android:id="@+id/nested_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:scrollbars="vertical"
android:layout_gravity="bottom"
android:scrollingCache="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="@dimen/spacing_middle"
android:paddingLeft="@dimen/spacing_mlarge"
android:paddingRight="@dimen/spacing_mlarge"
android:paddingTop="@dimen/spacing_middle">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/spacing_medium"
android:orientation="vertical"
android:padding="@dimen/spacing_medium">
<EditText
style="@style/EditText.Flat.Grey"
android:layout_width="match_parent"
android:layout_height="@dimen/spacing_xmlarge"
android:background="@drawable/edit_text_round_bg_outline"
android:inputType="text"
android:minHeight="@dimen/spacing_xmlarge"
android:paddingLeft="@dimen/spacing_large"
android:paddingRight="@dimen/spacing_large"
android:text="400" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/spacing_middle"
android:orientation="vertical">
<Button
style="@style/Button.Primary.Borderless"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/btn_rect_black_grey"
android:text="ADD"
android:textColor="@android:color/white" />
</LinearLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</LinearLayout>