1

windows风格对话框

 2 years ago
source link: http://www.androidchina.net/779.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
windows风格对话框 – Android开发中文站

下面这个实例是弹出一个对话框,模仿windows样式,大家可以下载看看,还是挺不错的。

效果图如下:



主要是通过一个自定义布局来实现的,布局xml文件如下:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<RelativeLayout
android:id="@+id/customviewlayTitle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#1A94F9" >
<TextView
android:id="@+id/customviewtvTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:padding="10dp"
android:text="关于我们"
android:textColor="#000000" />
<ImageButton
android:id="@+id/customviewtvimgCancel"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:background="@drawable/canceltor" />
</RelativeLayout>
<LinearLayout
android:id="@+id/customviewlayMessage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/customviewlayTitle"
android:orientation="vertical"
android:padding="20dp" >
<TextView
android:id="@+id/orthertv0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="原作者:asinzuo"
android:textColor="#000000" />
<TextView
android:id="@+id/orthertv1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:linksClickable="true"
android:text="网站:http://www.androidchina.net/"
android:textColor="#000000" />
<TextView
android:id="@+id/orthertv2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:linksClickable="true"
android:text="Email:[email protected]"
android:textColor="#000000" />
</LinearLayout>
<LinearLayout
android:id="@+id/customviewlayLink"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/customviewlayMessage"
android:orientation="horizontal"
android:paddingBottom="20dp"
android:paddingLeft="20dp"
android:paddingRight="20dp" >
<Button
android:id="@+id/ortherbtnemil"
android:layout_width="fill_parent"
android:layout_height="40dp"
android:layout_marginRight="10dp"
android:layout_weight="1"
android:background="@drawable/linkbtnbged"
android:linksClickable="true"
android:text="Email给作者" />
<Button
android:id="@+id/ortherbtnweb"
android:layout_width="fill_parent"
android:layout_height="40dp"
android:layout_marginLeft="10dp"
android:layout_weight="1"
android:background="@drawable/linkbtnbged"
android:linksClickable="true"
android:text="访问网站" />
</LinearLayout>
</RelativeLayout>

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK