微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

【Android】43,android开发游戏app

android:layout_width=“match_parent”

android:layout_height=“250dp”

android:orientation=“vertical”>

<LinearLayout

android:layout_marginTop=“10dp”

android:layout_width=“match_parent”

android:layout_height=“wrap_content”

android:orientation=“vertical”>

<LinearLayout

android:layout_width=“match_parent”

android:layout_height=“wrap_content”>

<RelativeLayout

android:layout_weight=“2”

android:layout_width=“167dp”

android:layout_height=“192dp”>

<ImageView

android:layout_centerInParent=“true”

android:layout_width=“127dp”

android:layout_height=“162dp”

android:background="@drawable/dialog_photo" />

<LinearLayout

android:layout_marginLeft=“5dp”

android:layout_weight=“6”

android:orientation=“vertical”

android:layout_width=“match_parent”

android:layout_marginRight=“5dp”

android:layout_height=“192dp”>

<TextView

android:id="@+id/title"

android:layout_width=“match_parent”

android:layout_height=“wrap_content”

android:text=“新消息”

android:textStyle=“bold”

android:textAlignment=“center”

android:textSize=“22sp”/>

<TextView

android:id="@+id/contents"

android:layout_width=“match_parent”

android:layout_height=“match_parent”

android:scrollbars=“vertical”

android:text=“1.如果软件失效了,请等待修复。\n2.如果更新失败了,请手动更新。\n3.软件仅仅是整合搜索接口,不保存任何资源。”

android:textSize=“18sp”/>

<View

android:layout_marginTop=“5dp”

android:layout_width=“match_parent”

android:layout_height=“1dp”

android:background="#c0c0c0"/>

<RelativeLayout

android:id="@+id/btn_ok"

android:background="?android:attr/selectableItemBackground"

android:layout_width=“match_parent”

android:la


yout_height=“match_parent”>

<TextView

android:layout_width=“match_parent”

android:layout_height=“wrap_content”

android:text=“已查阅”

android:textAlignment=“center”

android:textSize=“20sp”

android:textStyle=“bold”

android:layout_centerInParent=“true”

android:textColor="@color/purple_500"/>

4.新建MyDialog.java文件

package jsz.nopi.firstapp;

import android.app.Dialog;

import android.content.Context;

import android.view.Gravity;

import android.view.View;

import android.view.Window;

import android.view.WindowManager;

public class MyDialog extends Dialog {

//style引用style样式

public MyDialog(Context context, int width, int height, View layout, int style) {

super(context, style);

setContentView(layout);

Window window = getwindow();

WindowManager.LayoutParams params = window.getAttributes();

params.gravity = Gravity.CENTER;

window.setAttributes(params);

}

}

5.修改MainActivity.java。

Window window = getwindow();

WindowManager.LayoutParams params = window.getAttributes();

params.gravity = Gravity.CENTER;

window.setAttributes(params);

}

}

5.修改MainActivity.java。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐