看到uc浏览器的主界面上,点击菜单选项之后,在这个上方弹出一个对话框,不知道是用什么实现的?这个有知道的大虾可以说一下,我就用一个activity设置成theme.Dailog实现,但是看里面的属性,找了很久,没有发现哪个是设置这些属性的,有知道的大虾麻烦讲解一下。。谢谢了

解决方案 »

  1.   

    自定义style,然后应用自定义的style到Activity
    android:theme="@style/你自定义的style"
      

  2.   

    xml文件<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >
    </RelativeLayout>
    style文件
    <?xml version="1.0" encoding="utf-8"?>
    <resources>    <style name="theme.common.dialog" parent="android:style/Theme.Dialog">
            <item name="android:windowNoTitle">true</item>
            <item name="android:windowIsTranslucent">true</item>
            <item name="android:windowAnimationStyle">@android:style/Animation.Translucent</item>
            <item name="android:windowBackground">@drawable/transparent_background</item> 
        </style></resources>manifest文件
    <activity
                android:name=".YourAct"
                android:screenOrientation="portrait"
                android:theme="@style/theme.common.dialog"
                 >
            </activity>
    自己调一下
      

  3.   

    我没有用自己的sytle,用的是系统的<style name="Theme.Dialog">,这个里面的属性我看了,不知道哪个是设置这个activity大小,位置的属性。
      

  4.   

    嗯,你这个自己写的sytle里面,没有设置大小,位置的属性吧?
      

  5.   

    创建res/values/styles.xml内容:<?xml version="1.0" encoding="utf-8"?> 
    <resources> 
            <!-- 自定义一个theme继承自android:style/Theme.Dialog-->
            <style name="Theme.myTheme" parent="android:style/Theme.Dialog"> 
                 <!--改变高,其它就能自己弄了吧??-->
                 <item name="android:height">10dip</item>
            </style> 
    </resources>
    然后在Activity的配置文件里:
    android:theme="@style/Theme.myTheme"
      

  6.   

    其实楼主的这个要求不应该这样子来实现的,应该用PopupWindow来实现,这也是一个浮动窗口,看过其它资料,差不多都是用PopupWindow来实现的
      

  7.   

    嗯,谢谢你的分享,PopupWindow实现的方法,我再到网上看看具体怎么实现的。用上面那个方法是已经实现了达到了透明显示的效果