I created an activity which is shown as pop up/ Dialog by following answers given in this question .
I did it by adding these lines in AndroidManifest
<activity
android:name=".package.Activity"
android:theme="@style/Theme.AppCompat.Light.Dialog.Alert" />
It works well as intended but the problem it shows Appname as title. I want to make it appear as AlertDialog. How to fix this?
I also cant use setTitle("") or label="" because empty space is left where appname was before.
您可以在Activity中简单地调用setTitle("")
函数。
Add this code to the top of the onCreate()
method of the Activity:
setTheme(R.style.{style}
The {style} should be ended with NoActionBar
. ie R.style.Theme_AppCompat_NoActionBar
And most importantly, add the code before these two lines of code (add it to the top of the method):
super.onCreate(savedInstanceState); setContentView(R.layout.{your layout});
Hope this answer helped!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.