Question

If I write a text in one of the two fields, the last textViews are displayed over the button...

Thats bad. I don't want it. I'm searching for an prosibilty to disable that. Maybe for example to hide the button if the keyboard is displayed
or make the text scrollable

donst worry abaut the grid, it gets in 9 rows TextViews

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/RelativeLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/padding_small"
android:paddingLeft="@dimen/padding_small"
android:paddingRight="@dimen/padding_small"
tools:context=".ActivityMain_plain" >

<Button
    android:id="@+id/Button_berechnen"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentRight="true"
    android:paddingBottom="@dimen/padding_small"
    android:paddingLeft="@dimen/padding_small"
    android:paddingRight="@dimen/padding_small"
    android:text="@string/Button_berechnen" />

<EditText
    android:id="@+id/input_ipAdresse"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_alignRight="@+id/Button_berechnen"
    android:layout_toRightOf="@+id/tV_input_snm_txt"
    android:ems="10"
    android:gravity="right"
    android:inputType="phone"
    android:paddingRight="@dimen/padding_small"
    android:textSize="@dimen/fontsize_medium" >

    <requestFocus android:layout_width="match_parent" />

</EditText>


<EditText
    android:id="@+id/input_snm"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignLeft="@+id/input_ipAdresse"
    android:layout_alignParentRight="true"
    android:layout_below="@+id/input_ipAdresse"
    android:ems="10"
    android:gravity="right"
    android:inputType="phone"
    android:paddingRight="@dimen/padding_small"
    android:textSize="@dimen/fontsize_medium" />

<TextView
    android:id="@+id/tV_input_snm_txt"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignBottom="@+id/input_snm"
    android:layout_alignParentLeft="true"
    android:paddingLeft="@dimen/padding_small"
    android:paddingRight="@dimen/padding_small"
    android:paddingTop="@dimen/padding_small"
    android:text="@string/input_snm"
    android:textAppearance="?android:attr/textAppearanceMedium" />

<TextView
    android:id="@+id/tV_input_ipAdresse"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignBottom="@+id/input_ipAdresse"
    android:layout_alignParentLeft="true"
    android:paddingLeft="@dimen/padding_small"
    android:paddingRight="@dimen/padding_small"
    android:paddingTop="@dimen/padding_small"
    android:text="@string/input_ipAdresse"
    android:textAppearance="?android:attr/textAppearanceMedium" />

<GridLayout
    android:id="@+id/table_gridLayout"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_below="@+id/input_snm"
    android:columnCount="5"
    android:fadingEdge="horizontal|vertical"
    android:paddingBottom="@dimen/padding_small"
    android:paddingLeft="@dimen/padding_small"
    android:paddingRight="@dimen/padding_small"
    android:paddingTop="@dimen/padding_medium"
    android:scrollbars="horizontal|vertical" >

</GridLayout>

<TextView
    android:id="@+id/tV_Klasse"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_below="@+id/table_gridLayout"
    android:layout_marginTop="10dp"
    android:paddingLeft="@dimen/padding_small"
    android:paddingRight="@dimen/padding_small"
    android:paddingTop="@dimen/padding_small"
    android:text="@string/txt_Klasse" />

<TextView
    android:id="@+id/tV_BitsNetz"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_below="@+id/tV_Klasse"
    android:paddingLeft="@dimen/padding_small"
    android:paddingRight="@dimen/padding_small"
    android:text="@string/txt_BitsNetz" />

<TextView
    android:id="@+id/tV_BitsSubnetz"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_below="@+id/tV_BitsNetz_erg"
    android:paddingLeft="@dimen/padding_small"
    android:paddingRight="@dimen/padding_small"
    android:text="@string/txt_BitsSubnetz" />

<TextView
    android:id="@+id/tV_BitsHost"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_below="@+id/tV_BitsSubnetz"
    android:paddingLeft="@dimen/padding_small"
    android:paddingRight="@dimen/padding_small"
    android:text="@string/txt_BitsHost" />

<TextView
    android:id="@+id/tV_MagischeZahl"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_below="@+id/tV_BitsHost"
    android:paddingLeft="@dimen/padding_small"
    android:paddingRight="@dimen/padding_small"
    android:text="@string/txt_MagischeZahl" />

<TextView
    android:id="@+id/tV_AnzahlHost"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_below="@+id/tV_AnzahlSubnetz"
    android:paddingLeft="@dimen/padding_small"
    android:paddingRight="@dimen/padding_small"
    android:text="@string/txt_AnzHosts" />

<TextView
    android:id="@+id/tV_AnzahlSubnetz"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignLeft="@+id/tV_MagischeZahl"
    android:layout_below="@+id/tV_MagischeZahl"
    android:paddingLeft="@dimen/padding_small"
    android:paddingRight="@dimen/padding_small"
    android:paddingTop="@dimen/padding_small"
    android:text="@string/txt_AnzSubnetze" />

<TextView
    android:id="@+id/tV_Klasse_erg"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignBaseline="@+id/tV_Klasse"
    android:layout_alignBottom="@+id/tV_Klasse"
    android:layout_alignRight="@+id/input_snm"
    android:minWidth="100dp" />

<TextView
    android:id="@+id/tV_BitsNetz_erg"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignBaseline="@+id/tV_BitsNetz"
    android:layout_alignBottom="@+id/tV_BitsNetz"
    android:layout_alignLeft="@+id/tV_Klasse_erg"
    android:minWidth="100dp" />

<TextView
    android:id="@+id/tV_BitsSubnetz_erg"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignBottom="@+id/tV_BitsSubnetz"
    android:layout_alignLeft="@+id/tV_Klasse_erg"
    android:minWidth="100dp" />

<TextView
    android:id="@+id/tV_BitsHost_erg"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignBaseline="@+id/tV_BitsHost"
    android:layout_alignBottom="@+id/tV_BitsHost"
    android:layout_alignLeft="@+id/tV_BitsNetz_erg"
    android:minWidth="100dp" />

<TextView
    android:id="@+id/tV_MagischeZahl_erg"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignBaseline="@+id/tV_MagischeZahl"
    android:layout_alignBottom="@+id/tV_MagischeZahl"
    android:layout_alignLeft="@+id/tV_BitsHost_erg"
    android:minWidth="100dp" />

<TextView
    android:id="@+id/tV_AnzahlSubnetz_erg"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignBottom="@+id/tV_AnzahlSubnetz"
    android:layout_alignLeft="@+id/tV_BitsHost_erg"
    android:minWidth="100dp" />

<TextView
    android:id="@+id/tV_AnzahlHost_erg"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignBottom="@+id/tV_AnzahlHost"
    android:layout_alignLeft="@+id/tV_MagischeZahl_erg"
    android:minWidth="100dp" />
</RelativeLayout>

I know why, but no good way how to fix it... I know with relative layouts overlays are possible, but here I don't want it...

Was it helpful?

Solution

If I understand correctly, this might solve your problem:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                xmlns:tools="http://schemas.android.com/tools"
                android:id="@+id/RelativeLayout"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:paddingBottom="@dimen/padding_small"
                android:paddingLeft="@dimen/padding_small"
                android:paddingRight="@dimen/padding_small"
                tools:context=".ActivityMain_plain">

    <Button
            android:id="@+id/Button_berechnen"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_alignParentLeft="true"
            android:layout_alignParentRight="true"
            android:paddingBottom="@dimen/padding_small"
            android:paddingLeft="@dimen/padding_small"
            android:paddingRight="@dimen/padding_small"
            android:text="@string/Button_berechnen"/>

    <EditText
            android:id="@+id/input_ipAdresse"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentTop="true"
            android:layout_alignRight="@+id/Button_berechnen"
            android:layout_toRightOf="@+id/tV_input_snm_txt"
            android:ems="10"
            android:gravity="right"
            android:inputType="phone"
            android:paddingRight="@dimen/padding_small"
            android:textSize="@dimen/fontsize_medium">

        <requestFocus android:layout_width="match_parent"/>

    </EditText>


    <EditText
            android:id="@+id/input_snm"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignLeft="@+id/input_ipAdresse"
            android:layout_alignParentRight="true"
            android:layout_below="@+id/input_ipAdresse"
            android:ems="10"
            android:gravity="right"
            android:inputType="phone"
            android:paddingRight="@dimen/padding_small"
            android:textSize="@dimen/fontsize_medium"/>

    <TextView
            android:id="@+id/tV_input_snm_txt"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@+id/input_snm"
            android:layout_alignParentLeft="true"
            android:paddingLeft="@dimen/padding_small"
            android:paddingRight="@dimen/padding_small"
            android:paddingTop="@dimen/padding_small"
            android:text="@string/input_snm"
            android:textAppearance="?android:attr/textAppearanceMedium"/>

    <TextView
            android:id="@+id/tV_input_ipAdresse"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@+id/input_ipAdresse"
            android:layout_alignParentLeft="true"
            android:paddingLeft="@dimen/padding_small"
            android:paddingRight="@dimen/padding_small"
            android:paddingTop="@dimen/padding_small"
            android:text="@string/input_ipAdresse"
            android:textAppearance="?android:attr/textAppearanceMedium"/>

    <ScrollView android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_above="@+id/Button_berechnen"
                android:layout_below="@+id/input_snm">

        <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical">

            <GridLayout
                    android:id="@+id/table_gridLayout"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:columnCount="5"
                    android:fadingEdge="horizontal|vertical"
                    android:paddingBottom="@dimen/padding_small"
                    android:paddingLeft="@dimen/padding_small"
                    android:paddingRight="@dimen/padding_small"
                    android:paddingTop="@dimen/padding_medium"
                    android:scrollbars="horizontal|vertical">

            </GridLayout>

            <TextView
                    android:id="@+id/tV_Klasse"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="10dp"
                    android:paddingLeft="@dimen/padding_small"
                    android:paddingRight="@dimen/padding_small"
                    android:paddingTop="@dimen/padding_small"
                    android:text="@string/txt_Klasse"/>

            <TextView
                    android:id="@+id/tV_BitsNetz"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:paddingLeft="@dimen/padding_small"
                    android:paddingRight="@dimen/padding_small"
                    android:text="@string/txt_BitsNetz"/>

            <TextView
                    android:id="@+id/tV_BitsSubnetz"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:paddingLeft="@dimen/padding_small"
                    android:paddingRight="@dimen/padding_small"
                    android:text="@string/txt_BitsSubnetz"/>

            <TextView
                    android:id="@+id/tV_BitsHost"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:paddingLeft="@dimen/padding_small"
                    android:paddingRight="@dimen/padding_small"
                    android:text="@string/txt_BitsHost"/>

            <TextView
                    android:id="@+id/tV_MagischeZahl"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:paddingLeft="@dimen/padding_small"
                    android:paddingRight="@dimen/padding_small"
                    android:text="@string/txt_MagischeZahl"/>

            <TextView
                    android:id="@+id/tV_AnzahlHost"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:paddingLeft="@dimen/padding_small"
                    android:paddingRight="@dimen/padding_small"
                    android:text="@string/txt_AnzHosts"/>

            <TextView
                    android:id="@+id/tV_AnzahlSubnetz"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:paddingLeft="@dimen/padding_small"
                    android:paddingRight="@dimen/padding_small"
                    android:paddingTop="@dimen/padding_small"
                    android:text="@string/txt_AnzSubnetze"/>

            <TextView
                    android:id="@+id/tV_Klasse_erg"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:minWidth="100dp"/>

            <TextView
                    android:id="@+id/tV_BitsNetz_erg"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:minWidth="100dp"/>

            <TextView
                    android:id="@+id/tV_BitsSubnetz_erg"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:minWidth="100dp"/>

            <TextView
                    android:id="@+id/tV_BitsHost_erg"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:minWidth="100dp"/>

            <TextView
                    android:id="@+id/tV_MagischeZahl_erg"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:minWidth="100dp"/>

            <TextView
                    android:id="@+id/tV_AnzahlSubnetz_erg"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:minWidth="100dp"/>

            <TextView
                    android:id="@+id/tV_AnzahlHost_erg"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:minWidth="100dp"/>
        </LinearLayout>

    </ScrollView>

</RelativeLayout>

I haven't actually tested the code, but the notion should be correct.

Also, I would strongly suggest you revisit your XML layout, as it could be improved.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top