---
title: "Android 设置背景透明"
author: "bleet"
date: "2010-12-29T15:40:12Z"
tags: []
categories: ["移动开发"]
slug: "android"
draft: false
lastmod: "2010-12-29T15:40:12Z"
id: 854933
url: "https://bleet.iteye.com/blog/854933"
---

layout文件里的写法：

```xml

<TextView
	         android:id="@+id/disable_div"
    		android:layout_width="fill_parent" 
    		android:layout_height="fill_parent"
    		android:gravity="center"
    		android:visibility="gone"
    		/>


```
  
java文件的写法（0x80000000是灰色，值可以自己选）：

```java

disable_div = (TextView) findViewById(R.id.disable_div);
disable_div.setBackgroundColor(0x80000000);

```