dystroy 2013-02-28 08:21 采纳率: 80%
浏览 9364
已采纳

如何把 activity 的背景设置成白色?

我有下面的布局,当我点击一个按钮会加载一个新的图像。当加载图像时,activity的背景是黑色的。如何把这个背景色变成白色的呢?

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:id="@+id/LinearLayoutChart" android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android" android:background="#ffffff" android:orientation="vertical">
    <LinearLayout android:id="@+id/linearLayout1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="0">
        <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/fiveDayChartButton" android:background="@drawable/fiveday"></Button>
        <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/threeMonthChartButton" android:background="@drawable/threemonth"></Button>
        <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/sixMonthChartButton" android:background="@drawable/sixmonth"></Button>
        <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/ytdChartButton" android:background="@drawable/ytd"></Button>
        <Button android:layout_width="wrap_content" android:id="@+id/oneYearChartButton" android:layout_height="wrap_content" android:background="@drawable/oneyear"></Button>
        <Button android:layout_height="wrap_content" android:id="@+id/fiveYearChartButton" android:layout_width="wrap_content" android:background="@drawable/fiveyear"></Button>
    </LinearLayout>
<ImageView android:id="@+id/chartImageViewLandscape" android:layout_height="fill_parent" android:layout_width="fill_parent" android:layout_weight="1"></ImageView>

</LinearLayout>
  • 写回答

2条回答

  • xiaoyan_12 2013-03-04 06:04
    关注

    在下载时,你设置一个“fake”下拉列表:

    DownloadedDrawable downloadedDrawable = new DownloadedDrawable(task);
    imageView.setImageDrawable(downloadedDrawable);
    

    这个 DownloadedDrawable 仅仅是一个 ColorDrawable,它有一个黑色的背景:

    public DownloadedDrawable(...) {
        super(Color.BLACK);
       ...
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥15 stable diffusion
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘