2017-02-06 1 views
-2

는 다음과 같이 레이아웃의 배경색 어떻게됩니까 : Button 가시성을 "보이지 않는"로 설정하면 1 이 RelativeLayout의 배경 색상에 어떤 일이 일어날 것안드로이드에서 배경색으로 빈 레이아웃을 사용하면 어떻게됩니까?

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:paddingBottom="@dimen/activity_vertical_margin" 
android:paddingLeft="@dimen/activity_horizontal_margin" 
android:paddingRight="@dimen/activity_horizontal_margin" 
android:paddingTop="@dimen/activity_vertical_margin" 
android:background="@color/colorPrimary" 
> 

<Button 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:textStyle="bold" 
    android:text="Button" 
    android:textSize="20sp" 
    android:visibility="gone" 
    android:textColor="@android:color/white" 
    android:layout_centerVertical="true" 
    android:layout_centerHorizontal="true"/> 

케이스?

사례 2Button 가시성을 "GONE"로 설정하면 RelativeLayout의 배경 색상에 무슨 일이 일어날 지 ?

+1

버튼 가시성이 보이지 않거나 사라지면 RelativeLayout의 배경색에는 아무런 변화가 없습니다. –

+3

더 적은 시간에 직접 시도해보십시오. –

+1

당신은 그것을 시도 할 수 있습니다 : D –

답변

0

상대적 레이아웃에는 영향을 미치지 않습니다. 단추가 보이지 않는 상태에서 단추가 사라졌지만 같은 배경의 상대적 레이아웃이 여전히 있습니다. 더 많은 참조 용이 link 희망 도움말을 참조하십시오. :)

+0

링크 해 주신 Pratik에게 감사드립니다. :) – Pavan

+0

@Pavan 아무 문제 행복 코딩. :) –

0

아무것도 아니요. Layout의 배경색을 변경하고 있기 때문에 버튼 자체가 아닙니다!

관련 문제