Deryl_Myrawill
Deryl_Myrawill

Reputation: 14

the softkeyboard makes view disappear when it pops up

I have this situation

before keyboard

when i get the focus on the inputText, therefore triggering the softkeyboard to show up, the second text and the second button disappear.

I tried to examine with the debbugger, the associated object are still there, so i though they were just invisibile, so i modified thier visibility but the result stays the same.

after keyboard

in other activities i've never had this problem when softkeyboard showed up. what's new is that in this one i'm using a viewpageadapter, and this screen is one of it's fragment.

Considering that I MUSTN'T remove the viewpageadapter, how can I made the last two views visibile?

As of now, i haven't associated code to them 'cause... for now they are invisibile and so inaccessibile

here is the current code of this fragment:

public class TabComb extends Fragment {

private EditText input;
private TextView outCon, outCov;
private Button getCon, getCov;

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {

    View root = inflater.inflate(R.layout.fragment_tab_comb, container, false);

    input = root.findViewById(R.id.input_lineare);
    outCon = root.findViewById(R.id.output_conica);
    outCov = root.findViewById(R.id.output_convessa);
    getCon = root.findViewById(R.id.getConica);
    getCov = root.findViewById(R.id.getConvessa);

    getCon.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            String scalare = String.valueOf(input.getText());
            Scalare S = new Scalare();
            //TODO convertire input testo in vettore
            //outCon.setText(S.MatrixToString(S.getConica(scalare)));
        }
    });

    outCov.setVisibility(View.VISIBLE);
    getCov.setVisibility(View.VISIBLE);

    return root;
}

and there is the .xml

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".ui.combinazioni.TabComb">

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <EditText
            android:id="@+id/input_lineare"
            android:layout_width="250dp"
            android:layout_height="wrap_content"
            android:layout_marginStart="50dp"
            android:layout_marginTop="32dp"
            android:hint="@string/lin_input"
            android:inputType="text"
            android:minHeight="50dp"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            android:autofillHints="" />

        <TextView
            android:id="@+id/output_conica"
            android:layout_width="260dp"
            android:layout_height="35dp"
            android:layout_marginTop="80dp"
            android:hint="@string/conica_output"
            app:layout_constraintStart_toStartOf="@+id/input_lineare"
            app:layout_constraintTop_toBottomOf="@+id/input_lineare" />

        <TextView
            android:id="@+id/output_convessa"
            android:layout_width="260dp"
            android:layout_height="39dp"
            android:layout_marginTop="90dp"
            android:hint="@string/convessa_output"
            android:visibility="visible"
            app:layout_constraintStart_toStartOf="@+id/output_conica"
            app:layout_constraintTop_toBottomOf="@+id/output_conica"
            tools:visibility="visible" />

        <Button
            android:id="@+id/getConica"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="16dp"
            android:text="@string/conica_butt"
            android:textColor="#FFFFFF"
            android:visibility="visible"
            app:layout_constraintStart_toStartOf="@+id/output_conica"
            app:layout_constraintTop_toBottomOf="@+id/output_conica"
            tools:ignore="TextContrastCheck"
            tools:visibility="visible" />

        <Button
            android:id="@+id/getConvessa"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="16dp"
            android:text="@string/convessa_butt"
            android:textColor="#FFFFFF"
            android:visibility="visible"
            app:layout_constraintStart_toStartOf="@+id/output_convessa"
            app:layout_constraintTop_toBottomOf="@+id/output_convessa"
            tools:ignore="TextContrastCheck"
            tools:visibility="visible" />
    </androidx.constraintlayout.widget.ConstraintLayout>

</FrameLayout>

What do i have to change?

should i have to "rebuild" everytime the inputText lost it's focus??

Upvotes: -1

Views: 28

Answers (0)

Related Questions