我实际上正在为 Android 编写一个应用程序,我需要一些帮助来做某事。我需要用这张图片做一种弹出消息:http: //img716.imageshack.us/img716/9331/postitz.png。此图像必须有 2 个 TextView,其中一个是标题,另一个是消息。
我尝试了一些选项,例如具有自己的布局、自己的样式的对话框,但图像填充了整个屏幕,而不是包装 TextViews 的内容。我也尝试过使用新的 Activity 并发生相同的情况,图像填满了整个屏幕。
我的实际布局是这样的:
<?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"
android:gravity="center_vertical"
android:background="@android:color/white">
<LinearLayout
android:id="@+id/img_postit"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:background="@drawable/postit"
android:orientation="vertical">
<TextView
android:id="@+id/note_titulo"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:padding="30dp"/>
<TextView
android:id="@+id/note_descr"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:padding="30dp"/>
</LinearLayout>
</LinearLayout>
但是我尝试了很多不同的组合,RelativeLayout、FrameLayout,但我找不到解决方案。
任何想法如何解决它?
谢谢大家。