Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to remove the White Border Code from Dialog in Android

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article will explain in detail how to remove the white border code of Dialog in Android. The content of the article is of high quality, so the editor will share it with you for reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.

Using the style file, create a new styles.xml file in the values directory and write the following code:

@ null

True

False

True

@ android:color/black

@ null

False

When calling, the API class of AlerDialog is used, and the Dialog API is written as follows:

Dialog dialog = new Dialog (SetActivity.this, R.style.dialog)

Dialog.setContentView (R.layout.test)

Dialog.show ()

Let's take a look at the source file of Dialog, where the constructor is as follows:

Public Dialog (Context context, int theme) {

MContext = new ContextThemeWrapper (

Context, theme = = 0? Com.android.internal.R.style.Theme_Dialog: theme)

MWindowManager = (WindowManager) context.getSystemService ("window")

Window w = PolicyManager.makeNewWindow (mContext)

MWindow = w

W.setCallback (this)

W.setWindowManager (mWindowManager, null, null)

W.setGravity (Gravity.CENTER)

MUiThread = Thread.currentThread ()

MDismissCancelHandler = new DismissCancelHandler (this)

}

In this we can see that Android uses the default constructor to set the style for Dialog, if there is no style for it, that is, the default loads the pre-written style file, Dialog consists of multiple 9.png images, most of which are 9.png pictures with borders, so that is why the above style file should remove its background. This thing has been messing with me for a long time. I hope it will help you.

Comparison of the effect before and after

Before setting:

After setting up:

On Android Dialog how to remove the white border code is shared here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report