Reputation: 11158
I 've a LinearLayout with 2 views, view A which takes some vertical space, and view B which takes the rest of the layout.
<LinearLayout
android:id="@+id/ly2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/input"
android:orientation="vertical" >
<View
android:id="@+id/view1"
android:layout_width="match_parent"
android:layout_height="50dp" >
</View>
<WebView
android:id="@+id/webview"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
At some point I want to remove view A. How do I tell LinearLayout to refresh so view B takes the entire space?
Best Regards.
Upvotes: 0
Views: 1618
Reputation: 801
try to replace your xml with this code
<RelativeLayout
android:id="@+id/ly2"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<View
android:id="@+id/view1"
android:layout_width="match_parent"
android:layout_height="50dp" >
</View>
<WebView
android:id="@+id/webview"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
In your main activity where this xml is used put this
View view=(View)findViewById(R.id.view1);
view.setVisibility(View.GONE);
Upvotes: 2