1
在我的应用程序中,我想显示弹出对话框。我为第一阶段画了草图。在这里我想:Android -alert对话框设计
我试图实现这一点,这里是我的代码:
<TableLayout 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:shrinkColumns="*"
android:stretchColumns="*"
android:background="#ffffff"
tools:context=".CustomMainActivity" >
<TableRow
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:gravity="center_horizontal"
android:background="#b6006a">
<ImageView
android:id="@+id/ImageView1"
android:src="@drawable/icon"
android:layout_weight="1"
android:padding="10dip"
android:adjustViewBounds="true"
android:layout_width="70dp"
android:layout_height="70dp"
android:scaleType="fitXY"
android:gravity="right"/>
<TextView
android:id="@+id/TextView1"
android:layout_weight="1"
android:textSize="18dp"
android:text="Nava Messenger"
android:padding="10dip"
android:background="#b6006a"
android:textColor="#fff"
android:gravity="left"/>
</TableRow>
<TableRow
android:id="@+id/tableRow0"
android:layout_height="wrap_content"
android:layout_width="match_parent">
<TextView
android:id="@+id/TextViewSender"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="18dp"
android:layout_span="3"
android:maxLines="1"
android:background="#fff"
android:textColor="#000"/>
</TableRow>
<TableRow
android:id="@+id/tableRow1"
android:layout_height="wrap_content"
android:layout_width="match_parent">
<TextView
android:id="@+id/TextView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="18dp"
android:layout_span="3"
android:maxLines="4"
android:padding="18dip"
android:background="#fff"
android:textColor="#000"/>
</TableRow>
<TableRow
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:gravity="center_horizontal">
<EditText
android:id="@+id/EditText1"
android:layout_weight="3"
android:inputType="textCapWords"
android:layout_width="0dp"
android:ellipsize="start"
android:gravity="center"
android:textColor="#b6006a"
android:hint="Write a message..."/>
<ImageButton
android:id="@+id/ImageButton1"
android:layout_weight="1"
android:layout_width="0dp"
android:adjustViewBounds="true"
android:background="@null"
android:scaleType="fitXY"
android:src="@drawable/send_now"
android:gravity="right"/>
</TableRow>
</TableLayout>
而且这段代码的结果是:
我想修改一些如:
- 减少头大小(在警告对话框的顶部紫色区域)上的头
- 降低图像尺寸(标志图像的真实大小为:128 * 128)
- 减少发送图像(发送图像的真实尺寸是: 48 * 48)
- 把发送图像和EditText上某一行
什么建议吗?
我建议您删除TableLayout并使用RelativeLayout,因为它可以让您更好地控制放置视图的位置。 –