2016-02-16 16 views
1

我有2個活動ProgressDialog。相同的進步對話框樣式活動

第一活動代碼:

@Override 
    protected void onPreExecute() { 
     super.onPreExecute(); 
     mProgressDialog = new ProgressDialog(ShowGuestPhoto.this); 
     mProgressDialog.setTitle("Загрузка фотографий"); 
     mProgressDialog.setMessage("Загрузка.."); 
     mProgressDialog.setIndeterminate(false); 
     mProgressDialog.show(); 
     Typeface avenirnextregular= Typeface.createFromAsset(getAssets(), "avenirnextregular.ttf"); 
     ((TextView) mProgressDialog.findViewById(getResources().getIdentifier("alertTitle", "id", "android"))).setTypeface(avenirnextregular); 
    } 

here is截圖是如何看待喜歡。

我的第二個活動代碼:

Override 
    protected void onPreExecute() { 
     super.onPreExecute(); 
     mProgressDialog = new ProgressDialog(GiftsActivity.this); 
     mProgressDialog.setTitle("Подарки"); 
     mProgressDialog.setMessage("Пожалуйста, подождите: обновляется список подарков"); 
     mProgressDialog.setIndeterminate(false); 
     mProgressDialog.show(); 
     Typeface avenirnextregular= Typeface.createFromAsset(getAssets(), "avenirnextregular.ttf"); 
     ((TextView) mProgressDialog.findViewById(getResources().getIdentifier("alertTitle", "id", "android"))).setTypeface(avenirnextregular); 
    } 

here is截圖是如何看待喜歡。

代碼是相同的!

,所以我有問題:

爲什麼有不一樣嗎?

2.如何讓我的應用程序中的所有ProgressDialog像第一次截圖一樣?

Manifest: 
<activity android:name="com.appforwed.ShowGuestPhoto" 
      android:screenOrientation="portrait"/> 
<activity android:name="com.appforwed.GiftsActivity" 
      android:screenOrientation="portrait" 
      android:theme="@android:style/Theme.NoTitleBar.Fullscreen"/> 

UPD。

<application 
    android:allowBackup="true" 
    android:largeHeap ="true" 
    android:icon="@mipmap/ic_launcher" 
    android:label="@string/app_name" 
    android:screenOrientation="portrait" 
    android:theme="@style/Theme.AppCompat.NoActionBar" 
    android:name="com.photolab.Lab"> 
+0

priviet :)請發表您的AndroidManifest.xml –

+0

@ g2o,女貞! :)發佈。但在我的第三個活動中有同樣的問題(它沒有任何android:主題。 – androidFan

+0

你有沒有爲應用程序設置一些主題? –

回答

2
  1. 爲什麼有不一樣嗎?

每個活動都有不同的風格應用,這就是爲什麼他們看起來不同。

  1. 如何讓我的應用程序中的所有ProgressDialog像第一個截圖一樣?

,使它們看起來同父同剛創建的風格主題的孩子,你的情況最好Theme.AppCompat


您可以創建這樣的自定義樣式:

<style name="Theme.AppCompat.NoActionBar.FullScreen" parent="@style/Theme.AppCompat"> 
    <item name="windowNoTitle">true</item> 
    <item name="windowActionBar">false</item> 
    <item name="android:windowFullscreen">true</item> 
    <item name="android:windowContentOverlay">@null</item> 
</style> 

並將@android:style/Theme.NoTitleBar.Fullscreen更改爲您的自定義Theme.AppCompat.NoActionBar.FullScreen

對於更多的信息檢查這個問題有關你的問題:Full Screen Theme for AppCompat

希望它有幫助!

Надеюсь,поможет;)

+0

優秀,它的作品!謝謝:) [Спасибо:)] – androidFan