`
venus585625
  • 浏览: 248747 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

Android全透明Activity示例

阅读更多
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>

 

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

       package="com.example.android.xxxx">

 

    <application android:persistent="true"

          android:label="@string/home_title"

          android:icon="@drawable/ic_launcher_home">

        <activity android:name="xxxxxxxx"

           android:theme="@android:style/Theme.Translucent">
            <intent-filter>
              <action android:name="android.intent.action.LAUCHER" />

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

            </intent-filter>
        </activity>
    </application>
</manifest>

 

 

xxxxxxxx.java
package com.example.android.xxxx;
 

public class fpToolbar extends Activity {
 

    @Override
    public void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       requestWindowFeature(Window.FEATURE_NO_TITLE);
    LinearLayout layout2;
    layout2 = new LinearLayout(this);
        Button b = new Button(this);
    Button b2 = new Button(this);
    layout2.addView(b);
    layout2.addView(b2);
 

    layout2.setGravity(Gravity.BOTTOM | Gravity.LEFT);
    layout2.setBackgroundDrawable(null);    /* 设置成透明,必须在AndroidManifest.xml中设置android:theme="@android:style/Theme.Translucent" */
 

    b.setText("test pop.");
    b2.setText("hello!");
 

    setContentView(layout2); 
    }
}


本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/ccwwff/archive/2010/10/26/5965668.aspx
分享到:
评论
1 楼 wayneliquan 2014-04-17  
如何让全透明的activity不接受,点击事件?我已经实现了不接受touch事件,请问楼主如何解决?

相关推荐

Global site tag (gtag.js) - Google Analytics