Reputation: 575
i have several xml layouts on my project. when the application start the main.xml layout is load on the device. when i load a second xml layout it get infront from the main but do not cover all the screen and also you are albe to see that behind is the main.xml layout
the second layout am using match_parent and the xml code is
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent" android:weightSum="1">
//something
</LinearLayout>
this tham am trying to do is that the second layout to take all the screen and not be able to see the main on the back . is this possible to be done?
EDIT
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TableLayout android:layout_width="match_parent"
android:layout_height="match_parent" >
<TableRow >
<TextView android:text="Password Recovery" android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="match_parent"></TextView>
</TableRow>
<TableRow >
<TextView android:text="Username: " android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
<EditText android:text=" " android:id="@+id/UsernameRecovery" android:layout_width="100dp" android:layout_height="45dp"></EditText>
</TableRow>
<TableRow >
<Button android:text="Submit" android:id="@+id/SubmitRecoveryPass" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
<Button android:text="Cancel" android:id="@+id/CancelRecoveryPass" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
</TableRow>
</TableLayout>
</LinearLayout>
what i have to change in order to be full screen and not to be able see on the back
Upvotes: 2
Views: 162
Reputation: 23606
If you want is to be done on Single activity then use to hide the Layout while showing another layout.
Means hide main Layout while open the Second Layout. And Same thing for Main Layout also.
Adnd if you dont want it to be done in Single activity then try this.
Create two xml. as like main.xml and second.xml now in calling of first activity setContentLayout(R.layout.main); and while call second activity then setContentLayout(R.layout.second);
By defalut android hide the first activity and show the second activity.
Yes but make sure that you are using fill_parent on the parent layout of the both the xml.
Hope it will help you.
Enjoy. :))
Upvotes: 2
Reputation: 6086
It sounds like what you need is two activities. Launch your second activity, which has the layout you want on top, from the first, which uses the main.xml.
See this for more on starting activities: http://developer.android.com/reference/android/app/Activity.html#startActivity(android.content.Intent)
Upvotes: 2