---
title: "安卓布局设置背景色处理"
author: "corelengine"
date: "2016-09-27T09:27:17Z"
tags: []
categories: ["移动开发"]
slug: "untitled"
draft: false
lastmod: "2016-09-27T09:27:17Z"
id: 2327212
url: "https://corelengine.iteye.com/blog/2327212"
---

RelativeLayout dls_layout = (RelativeLayout) view.findViewById(R.id.dls_layout);
		if (userInfo != null&&"0".equals(userInfo.getIscandls())) {

			dls_layout.setClickable(true);
			dls_layout.setOnClickListener(this);
		}else{
			dls_layout.setClickable(false);
//			dls_layout.setBackgroundColor(R.color.main_color);//不可用
			
 
			
			dls_layout.setBackgroundColor(getResources().getColor(R.color.unclickablegray));
			 
		}