문제 설명
Android: ProgressBar가 활동에서 이상하게 보입니다. (Android: ProgressBar looks strange in activity)
</a></p>
새 디자인을 더 오래되어 보이는 progressBar를 표시하고 싶지 않아 시작하시겠습니까?
이것은 내 활동에 사용하고 있는 테마입니다.
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/progressBar"
android:layout_centerInParent="true"/>
이것은 내가 내 레이아웃 내 항목의 가시성을 변경합니다. 클릭하면 모든 것을 숨기고 progressBar를 표시하는 로그인 버튼이 있습니다. 로그인 버튼을 클릭하면 화면이 돌아가서 몇 초 동안 상단에 상태 표시줄을 표시하고 progressBar는 이전 비물질 테마 progressBar를 반영합니다. 상태바가 다시 사라지면 화면에 새로운 progressBar가 나타납니다.
항목의 가시성이 변경되면 테마가 존중되지 않는다고 생각합니까?
참조 솔루션
방법 1:
I think by mistake, I put in this style and attached it to the progressBar:
style="@style/Widget.AppCompat.ProgressBar"
Deleting it make it revert back to the material theme progressBar
EDIT:
After further investigations, it is actually due to the progressBar included within the facebook SDK. I had to take it out by following the advice in this thread: Android: How to hide progress circle in Facebook login copied and pasted here for your convenience.
I had the same problem with facebook sdk 4.x. When I click the facebook login button the Facebook Activity appears translucent but it shows a progress bar. Luckily we can disable this progress bar in the theme. So the Facebook Activity is declared as
<activity
android:name="com.facebook.FacebookActivity"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="@string/app_name"
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
All we have to do is create a style that inherits from Theme.Translucent.NoTitleBar and hides the progress bar:
<style name="FullyTranslucent" parent="android:Theme.Translucent.NoTitleBar">
<item name="android:progressBarStyle">@style/InvisibleProgress</item>
</style>
<style name="InvisibleProgress">
<item name="android:visibility">gone</item>
</style>
Now set the theme of the activity to our new theme:
<activity
android:name="com.facebook.FacebookActivity"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="@string/app_name"
android:theme="@style/FullyTranslucent" />
Voila! The ProgressBar before login is gone.
방법 2:
This is a good solution
style="@android:style/Widget.ProgressBar.Inverse"
(by Simon、Simon、Ivan Rancic)