Reputation: 375
When I call setContentView with this view, it takes up the whole screen. I thought wrap_content and wrap_content would mean the view would be big enough to show the two strings only. I would like this to show just like a small dialog. Any ideas? How does an alert dialog use only the size that it needs? Thanks
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="80dp"
>
<TextView
android:id="@+id/dialog_title"
android:textSize="15sp"
android:gravity="center_horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="String 1"
/>
<TextView
android:id="@+id/dialog_text1"
android:textSize="10sp"
android:gravity="center_horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="String 2"
/>
</LinearLayout>
Upvotes: 0
Views: 251
Reputation: 6282
See http://developer.android.com/guide/topics/ui/dialogs.html for information on creating and using dialogs.
Upvotes: 1