How to automatically reset items when item is visible or invisible

Asked

Viewed 27 times

0

Example:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:fillViewport="true"
tools:context=".MainActivity" >

...

<EditText
    android:id="@+id/docli_vol"
    android:layout_width="221dp"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_alignStart="@+id/docli_text"
    android:layout_bellow="@+id/docli_prod"
    android:layout_marginTop="218dp"
    android:ems="10"
    android:gravity="right"
    android:hint="@string/ins_vol"
    android:inputType="numberDecimal"
    android:textSize="25sp"
    android:visibility="visible"
    android:layout_alignLeft="@+id/docli_text" />

<!-- INI QTD -->
<TextView
    android:id="@+id/docli_text_qtd"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignTop="@+id/docli_qtd"
    android:layout_toStartOf="@+id/docli_text"
    android:visibility="visible"
    android:text="QTD:"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:textSize="30sp"
    android:layout_toLeftOf="@+id/docli_text" />

<EditText
    android:id="@+id/docli_qtd"
    android:layout_width="221dp"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_alignStart="@+id/docli_text"
    android:layout_bellow="@+id/docli_prod"
    android:layout_marginTop="280dp"
    android:ems="10"
    android:gravity="right"
    android:hint="@string/ins_qtd"
    android:inputType="numberDecimal"
    android:textSize="25sp"
    android:visibility="visible"
    android:layout_alignLeft="@+id/docli_text" />

<!-- INI PRICE -->
<TextView
    android:id="@+id/docli_text_price"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignTop="@+id/docli_price"
    android:layout_toStartOf="@+id/docli_text"
    android:visibility="visible"
    android:text="Price:"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:textSize="30sp"
    android:layout_toLeftOf="@+id/docli_text" />

<EditText
    android:id="@+id/docli_price"
    android:layout_width="221dp"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_alignStart="@+id/docli_text"
    android:layout_bellow="@+id/docli_prod"
    android:layout_marginTop="342dp"
    android:ems="10"
    android:gravity="right"
    android:hint="@string/ins_price"
    android:inputType="numberDecimal"
    android:textSize="25sp"
    android:visibility="visible"
    android:layout_alignLeft="@+id/docli_text" />
    ...
<Button
    android:id="@+id/docli_btn_reg_prod"
    android:layout_width="match_parent"
    android:layout_height="70dp"
    android:drawableLeft="@drawable/plus"
    android:onClick="menuIni"
    android:tag="RegProduct"
    android:text="@string/regItem"
    style="@style/green_button"
    android:layout_gravity="left"
    android:layout_alignParentLeft="true"
    android:layout_alignParentBottom="true"
    android:layout_toLeftOf="@+id/docli_btn_edit_prod" />

<Button
    android:id="@+id/docli_btn_edit_prod"
    android:layout_width="205dp"
    android:layout_height="70dp"
    android:layout_alignTop="@+id/docli_btn_reg_prod"
    android:drawableLeft="@drawable/edit"
    android:onClick="Edit_product"
    android:text="@string/edititem"
    style="@style/orange_button"
    android:layout_alignLeft="@+id/docli_text" />

....

When the item is invisible it does not adjust. How to make a dynamic adjustment?

  • 1

    Please translate your question.

  • question is already translated. Being in a forum in Portuguese the questions should be asked in Portuguese and not in English @Jomar

  • Instead of INVISIBLE use GONE.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.