![](/img/trans.png)
[英]How can I remove the background behind the JtabbedPane, or change its colour
[英]how can I change background behind my spinner?
我有使用eclipse创建的标准登录活动New-> other-> Android活动-> New Login活动
(您可以尝试创建相同的活动...我正在使用“ Eclipse版本:Juno Service Release 1”)
我更改了#0099cc中的所有背景活动/片段
但是,当我从一项活动传递到另一项活动时,我会看到背景白色,如图像中所示。
你能帮助我吗?
我认为重要的代码如下:
showProgress(true);
/**
* 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>
我认为您需要为整个应用程序编写自己的样式, 这是Google的API指南。
我解决了我的问题(在尝试以多种方式管理样式之后),添加了一个简单的行:
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) {
...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.