In an android app, I have a second screen which contains only a ListView
. It is presented by clicking on a Button
in the main screen and is closed when the user clicked on an Item.
The problem is that there is a relatively big empty area in my second screen and does not look good.
The question is: how can I limit the size of my second screen so that it looks like a DialogBox
but with a ListView
?
ext: The ListView
is just an example and the content of the second screen could be every thing like a Compound View
which is complex but does not fill the whole screen. So it is important to me to implement the second screen in XML not programmatically.
XML-code of my second screen:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ListView
android:id="@+id/myListView2"
android:layout_width="300dp"
android:layout_height="300dp"
>
</ListView>
</LinearLayout>
-- I tried to limit the layout_width
and layout_height
of the second screen to wrap_content
or 300dp
but non of them works.
Thanks for your answer!