即時通訊嘗試爲我的Android應用程序構建一個Popup。它應該是一個不使用整個屏幕的活動,屏幕右側只有200dp,其餘的應該是透明的黑色。 http://i.stack.imgur.com/6APy6.png具有透明背景和動作欄的Android活動?
的Java:
public class ActivitySettings extends BaseActivity implements View.OnTouchListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_settings);
setFinishOnTouchOutside(true);
}
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
System.out.println("Klicked " + motionEvent.getAction());
// If we've received a touch notification that the user has touched
// outside the app, finish the activity.
if (MotionEvent.ACTION_OUTSIDE == motionEvent.getAction()) {
finish();
return true;
}
return false;
}
}
AndroidManifest:
<activity
android:name="com.cleverlize.substore.test.ActivitySettings"
android:label="@string/title_activity_settings"
android:theme="@style/Theme.Transparent">
</activity>
風格XML:
的是什麼樣子/我想有一個圖片
<style name="Theme.Transparent" parent="Theme.AppCompat.Light">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowBackground">@color/itemPremium</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowIsFloating">true</item>
<item name="android:backgroundDimEnabled">true</item>
</style>
所以我只需要調整和動作條......請幫助:)
getActionBar()返回null !!!!!!!。您必須使用 –
:this.requestWindowFeature(Window.FEATURE_ACTION_BAR);在設定上述主題之後的活動中 –