我似乎遇到了某種奇怪的問題,平鋪背景在某些條件下拉伸。當立即開始其他活動時,背景圖片會忽略平鋪
我的應用程序有一個歡迎屏幕(與登錄/註銷),因爲它的主要活動。如果用戶已登錄,他/她就會自動重定向到從onCreate
方法的另一個活動。
問題是,每當發生這種情況時,應用程序窗口的平鋪背景就會伸展。
現在,平鋪只要我「看到」的主要活動完全適用於所有的背景。也就是說,如果我從onCreate
刪除調用startIntent
- 或 - 如果我走「回」到歡迎屏幕,並從那裏繼續。
我也試過從onResume
「跳」,但問題依然存在。
經由themes.xml
<item name="android:windowBackground">@drawable/application_background</item>
drawable/application_background.xml
設置背景(其中還包括一個微妙梯度)
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<bitmap android:src="@drawable/noise" android:tileMode="repeat" />
</item>
<item>
<shape android:shape="rectangle">
<gradient android:angle="90"
android:startColor="#3000"
android:endColor="#0000" />
</shape>
</item>
</layer-list>
從WelcomeActivity.java
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.welcome);
// ... init buttons etc
// Jump directly to the reading list user already has valid credentials
if(hasValidCredentials()) {
startActivity(new Intent(this, ActivityReadingList.class));
}
}
的粗瘸子說明相關的代碼問題:
任何幫助,將不勝感激。
謝謝, /C
你發現之前對此的解決方案?我有類似的問題。首次運行時,單個磁貼會在初始活動中延伸。 – longhairedsi
不,我沒有遺憾:/ –
我也沒有,這似乎是一個Android bug – longhairedsi