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);
}
}
本文介绍了一个使用AndroidManifest.xml配置文件实现透明主题的Android应用程序案例。该应用通过设置Activity的主题为Theme.Translucent来达到背景透明的效果,并在Activity中创建了自定义布局。此外,文章还展示了如何在Activity中创建按钮并进行布局。
642

被折叠的 条评论
为什么被折叠?



