How do I open a list view at a specific activity location?

I want to open the List view at the bottom of the screen to almost the mid-screen minimum. I have no idea how to do this. I only have an idea that this can only be done in a fragment and I don't know how to use it in my current activity and xml. What I want is shown in the following image:

enter image description here

Hope my question is perfectly clear. I know how to implement a list view, but I don’t know how to implement it in the way I wanted (I want to appear and disappear, breaking other views). this list should overlap other views.

EDIT

including my Xml file so that if you see what I did in design

 <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
   >


<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
   >

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:contentDescription="content_desc_overlay"
        android:src="@drawable/ic_launcher"
        android:id="@+id/img_view"

        />


    <ImageView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:id="@+id/iv_overlay"
        android:src="@drawable/doom"
        android:scaleType="matrix"

        />

</FrameLayout>


    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Open List"
        android:id="@+id/btn_screenshot"
        android:layout_gravity="right|top"
        />

</RelativeLayout>

      

Any suggestion? Source code would be appreciated. thank

+3


source to share


2 answers


put the list view in a separate blank activity and in the manifest put the activity topic in the dialog

<activity
        android:name=".ui.activities.EditSignatureActivity"
        android:label="@string/title_activity_edit_signature"
        android:theme="@android:style/Theme.Holo.Light.Dialog" >
    </activity>

      

and when the open list button is clicked, new intents start:



public void openListButton_OnClick(View v) {
    Intent intent = new Intent(HomeActivity.this, List.class);
    startActivity(intent);
}

      

remember to resize your new listView as much as you want it to be sized and add margins to match the position you want.

+1


source


I'll give you a sample. You need to change. Ask if there is any doubt

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal" 
        android:layout_marginTop="50dp"
        android:id="@+id/top_row">

        <LinearLayout
            android:layout_width="0dip"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:gravity="center"
            android:orientation="horizontal" >

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:text="Text A" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="0dip"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:gravity="center"
            android:orientation="horizontal" >

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:text="Text B" />
        </LinearLayout>
    </LinearLayout>

    <ListView 
        android:id="@+id/listView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@+id/top_row"
        android:layout_marginBottom="15dp"
        android:layout_marginLeft="30dp"
        android:layout_marginRight="30dp"
        android:layout_marginTop="15dp"></ListView>

</RelativeLayout>

      



Note. You need to load a listView with data.

0


source







All Articles