我有使用eclipse创建的标准登录活动 新 - >其他 - > Android活动 - >新登录活动
(您可以尝试创建相同的活动......我正在使用“Eclipse版本:Juno Service Release 1”)
我更改了所有背景活动/片段:#0099cc
但是当我从一个活动转到另一个活动时,我会看到背景中的背景像白色一样。
你能帮助我吗?
我认为重要的代码如下:
showProgress(真);
/**
* Shows the progress UI and hides the login form.
*/
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
private void showProgress(final boolean show) {
// On Honeycomb MR2 we have the ViewPropertyAnimator APIs, which allow
// for very easy animations. If available, use these APIs to fade-in
// the progress spinner.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
int shortAnimTime = getResources().getInteger(android.R.integer.config_shortAnimTime);
mLoginStatusView.setVisibility(View.VISIBLE);
**I tried in this way**
mLoginStatusView.setBackgroundColor(Color.parseColor("#0099cc"));
mLoginStatusView.animate().setDuration(shortAnimTime).alpha(show ?1 : 0).setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
mLoginStatusView.setVisibility(show? View.VISIBLE : View.GONE); }
});
mLoginFormView.setVisibility(View.VISIBLE);
mLoginFormView.animate().setDuration(shortAnimTime).alpha(show ? 0:1).setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
mLoginFormView.setVisibility(show ? View.GONE:View.VISIBLE);
}
});
} else {
// The ViewPropertyAnimator APIs are not available, so simply show
// and hide the relevant UI components.
mLoginStatusView.setVisibility(show ? View.VISIBLE : View.GONE);
mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE);
}
}
在login.xml布局中
<ProgressBar
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:background="#0099cc" />
在attrs.xml中
<!--
Declare custom theme attributes that allow changing which styles are
used for button bars depending on the API level.
?android:attr/buttonBarStyle is new as of API 11 so this is
necessary to support previous API levels.
-->
<declare-styleable name="ButtonBarContainerTheme">
<attr name="buttonBarStyle" format="reference" />
<attr name="buttonBarButtonStyle" format="reference" />
</declare-styleable>
答案 0 :(得分:0)
我认为您需要为整个应用程序编写自己的样式,here是Google的API指南。
答案 1 :(得分:0)
我解决了我的问题(在尝试以多种方式管理风格之后)添加一个简单的行:
getWindow()getDecorView()setBackgroundColor(Color.parseColor( “#0099CC”));
/**
* Shows the progress UI and hides the login form.
*/
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
private void showProgress(final boolean show) {
// On Honeycomb MR2 we have the ViewPropertyAnimator APIs, which allow
// for very easy animations. If available, use these APIs to fade-in
// the progress spinner.
getWindow().getDecorView().setBackgroundColor(Color.parseColor("#0099cc"));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
...