`
star65225692
  • 浏览: 268232 次
  • 性别: Icon_minigender_1
  • 来自: 上海
文章分类
社区版块
存档分类

Android将Activity伪装成Dialog

阅读更多

效果截图:

image

好像是Activity里声明的Dialog。其实是两个Activity,而且甚至是两个不同的App的Activity。实现这个效果很简单。

 

我创建了一个新的android项目。然后,给AndroidManifest文件中Activity添加了Dialog样式属性:

    
<?
xml version
=
"1.0"
 encoding
=
"utf-8"
?>

    
<
manifest
 
xmlns:android
=
"http://schemas.android.com/apk/res/android"

        
package
=
"com.easymorse.dialog"
 
android:versionCode
=
"1"

        
android:versionName
=
"1.0"
>

        
<
application
 
android:icon
=
"@drawable/icon"
 
android:label
=
"@string/app_name"
>

            
<
activity
 
android:name
=
".DialogActivity"
 
android:label
=
"@string/app_name"

               
android:theme
=
"@android:style/Theme.Dialog"
>

                
<
intent-filter
>

                    
<
action
 
android:name
=
"android.intent.action.MAIN"
 
/>

                    
<
category
 
android:name
=
"android.intent.category.LAUNCHER"
 
/>

                
</
intent-filter
>

            
</
activity
>


        
</
application
>

        
<
uses-sdk
 
android:minSdkVersion
=
"8"
 
/>


    
</
manifest
>

这样,如果运行该app的时候屏幕上正显示其他应用的Activity,就会出现上图的效果。在这里Activity被伪装成Dialog了。Activity一般给人的印象是要占满全屏的。伪装成Dialog的效果是只显示在部分屏幕中。

来自:http://dev.10086.cn/cmdn/bbs/thread-36982-1-1.html

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics