2013-03-18 3 views
0

안드로이드 배경 색상 변경

super.onCreate(savedInstanceState); 
     setContentView(R.layout.blog); 
     View linearLayout = findViewById(R.id.info); 

     TextView valueTV = new TextView(this); 
     valueTV.setText("hallo"); 
     valueTV.setId(5); 
     valueTV.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT)); 

     ((LinearLayout) linearLayout).addView(valueTV); 
    } 
다음

난이 프로그램을 컴파일하는 동안 white.But 끌 수있는 전체 활동 필요 서면 텍스트는 흰색 background.ie "hallo"단어는 흰색 배경.

도와주세요.

+1

'''안드로이드에 : 배경 = "#의 FFFFFF"'''그 이유는 당신을 텍스트에는 흰색 배경이 있습니다. –

+0

전체 활동을 흰색으로하려면 활동의 사용자 정의 테마를 설정하십시오. –

답변

0

XML의 LinearLayout의 너비와 폭이 wrap_content으로 설정 되었기 때문입니다. 전체 활동을 채우기 위해 이것을 fill_parent으로 변경하십시오. 현재로서는 TextView을 감싸는 중입니다.

0

변화하여 XML에

android:layout_width="wrap_content" 
android:layout_height="wrap_content" 

android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
0

사용이 ..

<?xml version="1.0" encoding="utf-8"?> 
    <LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:id="@+id/info" 
    android:layout_height="fill_parent" 
    android:orientation="vertical" 
    android:background="#FFFFFF"> 
    </LinearLayout>