0
votes

I want to make my second layout fill all the screen and covering all first layout, but it just keep displayed like big pop up, is there any solution for this?

here is description of my current diplayed layout :

|====================|
|first layout        |
|  |==============|  |
|  |              |  |
|  |second layout |  |
|  |              |  |
|  |              |  |
|  |              |  |
|  |              |  |
|  |              |  |
|  |              |  |
|  |              |  |
|  |              |  |
|  |==============|  |
|                    |
|====================|

what i need is to be looks like this:

|====================|
|second layout       |
|                    |
|                    |
|                    |
|                    |
|                    |
|                    |
|                    |
|                    |
|                    |
|                    |
|                    |
|                    |
|                    |
|====================|

here is my first layout xml :

<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:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".MainActivity" >

    <FrameLayout
        android:id="@+id/frameLayout1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:layout_marginBottom="60dp" >

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

            <Button
                android:id="@+id/btnRenungan"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="16dp"
                android:text="Renungan" />

            <Button
                android:id="@+id/btnGambar"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="0dp"
                android:text="Gambar" />

            <Button
                android:id="@+id/btnLokasi"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="Lokasi" />
        </LinearLayout>

        <LinearLayout android:layout_alignParentBottom="true"
            android:layout_centerHorizontal="true" android:layout_marginBottom="58px"
            android:layout_height="45px" android:layout_width="200px"
            android:id="@+id/lin_progress_bar" android:visibility="invisible">
            <ProgressBar
               android:id="@+id/progressBar"
               style="?android:attr/progressBarStyleLarge"
               android:layout_width="wrap_content"
               android:layout_height="wrap_content"
               android:layout_alignLeft="@+id/frameLayout1"
               android:layout_alignParentBottom="true" />
            <TextView android:id="@+id/TextView01" android:layout_height="fill_parent"
                android:layout_width="fill_parent" android:gravity="center_vertical"
                android:textStyle="bold" android:text="Loading..."
                android:layout_marginLeft="10px" android:textSize="23px"
                android:textColor="#808080"></TextView>
        </LinearLayout>
    </FrameLayout>
</RelativeLayout>

here is my second layout xml :

<?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"
    android:background="@drawable/background"
    android:orientation="vertical" >

    <ListView
        android:id="@+id/listRenungan"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:drawSelectorOnTop="false" 
        android:layout_weight="2"/>

    <ImageButton
         android:id="@+id/btnBack"
         android:layout_width="50dp"
         android:layout_height="50dp"
         android:layout_gravity="center"
         android:background="@drawable/button_back"
         android:drawable="@drawable/button_back"
         android:scaleType="fitXY" />

</LinearLayout>

here is my code for call second layout :

    case R.id.btnRenungan:
        //Activity Renungan
        Intent intentSelectionRenungan=new Intent(this, selectionRenungan.class);
        startActivity(intentSelectionRenungan);
5
Do you want to display second layout like dialog - user3355820
Hi! Small clarification: you are talking about two different activities right? - k3v1n4ud3
If you're talking about Activities, you might have this line in your manifest: android:theme="@android:style/Theme.Dialog". If you do, delete it. - Mike M.
yes, there are two different acctivities - christian
yes that just work great Mike. Thanks - christian

5 Answers

0
votes

Remove

android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"

from RelativeLayout and it should work.

0
votes

you should use weight

in this it will create 3 rows footer geader and middle portion in that u can adjust it will count in %

0
votes

If you want to make it nice u can use Fragment with this one u can make in one layout more layouts inside one.

look at this pic u can have on the one side for example a Listview and on the other side for example an ImageView

http://i.stack.imgur.com/BW4Ug.png

0
votes

change your second layout to this:

<LinearLayout android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true" 
        android:layout_height="match_parent" android:layout_width="match_parent"
        android:id="@+id/lin_progress_bar" android:visibility="invisible">
        <ProgressBar
           android:id="@+id/progressBar"
           style="?android:attr/progressBarStyleLarge"
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:layout_alignLeft="@+id/frameLayout1"
           android:layout_alignParentBottom="true" />
        <TextView android:id="@+id/TextView01" android:layout_height="fill_parent"
            android:layout_width="fill_parent" android:gravity="center_vertical"
            android:textStyle="bold" android:text="Loading..."
            android:layout_marginLeft="10px" android:textSize="23px"
            android:textColor="#808080"></TextView>
    </LinearLayout>
0
votes

Remove the paddings as @Boris said and in addition to that set your Frame Layouts height and width as match_parent.

<FrameLayout
    android:id="@+id/frameLayout1"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_alignParentBottom="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentRight="true"
    android:layout_alignParentTop="true"
    android:layout_marginBottom="60dp" >