AndroidManifest.xml
<?xmlversion="1.0"encoding="utf-8"?>
<manifestxmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.xxxx">
<applicationandroid:persistent="true"
android:label="@string/home_title"
android:icon="@drawable/ic_launcher_home">
<activityandroid:name="xxxxxxxx"
android:theme="@android:style/Theme.Translucent">
<intent-filter>
<actionandroid:name="android.intent.action.LAUCHER"/>
<categoryandroid:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
</application>
</manifest>
xxxxxxxx.java
packagecom.example.android.xxxx;
publicclassfpToolbarextendsActivity {
@Override
publicvoidonCreate(BundlesavedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
LinearLayoutlayout2;
layout2 =newLinearLayout(this);
Button b =newButton(this);
Button b2 =newButton(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);
}
}