安卓Api Demo学习 app/Activity/CustomDialog

来源:互联网 发布:程序员写博客到哪里 编辑:程序博客网 时间:2024/05/21 17:43

首先是AndroidManifest.xml中,关于Activity的配置

        <activity android:name=".app.CustomDialogActivity"                android:label="@string/activity_custom_dialog"  //Label相当于Dialog的Title                android:theme="@style/Theme.CustomDialog">   //配置为Dialog风格            <intent-filter>                <action android:name="android.intent.action.MAIN" />                <category android:name="android.intent.category.SAMPLE_CODE" />            </intent-filter>        </activity>

custom_dialog_activity.xml中的内容,只是一个简单的TextView

<TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/text"    android:layout_width="match_parent" android:layout_height="match_parent"    android:gravity="center_vertical|center_horizontal"       // 垂直水平居中    android:text="@string/custom_dialog_activity_text"/>

显示效果如下