I want to remove a framelayout containing a textview from the screen such that all the other layouts move up and take it's place. Here is the layout:
<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<EditText
android:id="@+id/etWarning"
android:layout_width="fill_parent"
android:layout_height="109dp"
android:clickable="false"
android:ems="10"
android:enabled="false"
android:focusable="false"
android:inputType="textMultiLine" />
</FrameLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingTop="10dp" >
<TextView
android:id="@+id/tvReasonLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/ndr_Reason"
android:textAppearance="?android:attr/textAppearanceMedium" />
<Spinner
android:id="@+id/spinNDRreasons"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/tvQueston"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="10dp"
android:paddingBottom="5dp"
android:text="Extra question goes here"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/etResponse"
android:layout_width="wrap_content"
android:layout_height="120dp"
android:layout_weight="1"
android:ems="10"
android:inputType="textMultiLine" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/cmdDoneNDR"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/cmd_done" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
The top layout is the one I want to be able to add/remove with the other layouts moving up if it's not there.
Do I need a framelayout at all?
thanks
give framelayout an id, and in your java activity code, set that view's setvisibility to gone.
or
actually since you only have one view inside that framelayout, you might just wanna do
etWarning.setVisibility(View.GONE); // this is for gone
etWarning.setVisibility(View.VISBLE); // this is to show it
hope this helps
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With