2013-12-19 3 views
0

버튼과 다른 버튼을 만들었습니다 ... 하지만 지금은 3 개의 버튼이 녹색, 빨간색, 파란색으로 만들어지기를 원치 않을 때 버튼 1 바로 아래에 있기를 원합니다.하지만 그렇지 않습니다. 난 당신이 날이 도움을 줄 수 소원 게재하는 것은새로운 선형 레이아웃을 만들 때

와 코드 메신저 가진 문제를 시작하고 오류가 마지막 마지막 마지막의 LinearLayout

이에 표시되는 것과 동일한 개체 내에서 끝나야합니다 -xml 문서를 받고 오류 메신저입니다

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

<LinearLayout 
    android:id="@+id/linearLayout1" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_weight="1" 
    android:orientation="vertical" > 

    <TextView 
     android:id="@+id/secondLine" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:text="@string/Greetings" 
     android:textSize="20sp" /> 

    <Button 
     android:id="@+id/Button1" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:text="@string/hello" /> 


</LinearLayout> 

<RelativeLayout 
    android:id="@+id/relativeLayout1" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_weight="1" > 


</RelativeLayout> 


    <LinearLayout 
     android:id="@+id/linearLayout2" 
     android:layout_width="fill_parent" 
     android:layout_height="20dp" 
     android:orientation="horizontal" > 

    <TextView 
     android:id="@+id/thirdLine" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:layout_weight="1" 
     android:layout_gravity="center" 
     android:background="#ff0000" 
     android:textColor="#000000" 
     android:text="red" /> 

    <TextView 
     android:id="@+id/fourthLine" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:layout_weight="1" 
     android:layout_gravity="center" 
     android:background="#00ff00" 
     android:textColor="#000000" 
     android:text="green" /> 

    <TextView 
     android:id="@+id/fifthLine" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:layout_weight="1" 
     android:layout_gravity="center" 
     android:background="#0000ff" 
     android:textColor="#000000" 
     android:text="blue" /> 

    <RelativeLayout 
    android:id="@+id/relativeLayout2" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_weight="1" > 


</RelativeLayout> 


    </LinearLayout> 

이것은 빨간색 파란색 녹색 버튼에 대한 그림이며 내 위치는 아래쪽에 있습니다. https://www.dropbox.com/s/73grdc0iff3ql3u/Untitled.png

이것은 내가 지금까지에 도달 할 것입니다하지만 난 당신은 당신의 XML 파일의 마지막에 하나 더 </LinearLayout>이 필요하다고 똑같이 https://www.dropbox.com/s/73grdc0iff3ql3u/Untitled.png

+0

정확히 무엇을 원하십니까? – Andrain

+0

원하는 스크린 샷을 게시 할 수 있습니까? – Piyush

+0

나는 그것이이 그림에서 하나처럼되고 싶다. 버튼과 버튼 만 작동하는 단어가있다. 나는 이것들을 필요로하는 동안 버튼을 누른다. https://www.dropbox.com/s/73grdc0iff3ql3u/Untitled.png –

답변

0

위의 그림과 같이 배포 할. 분당 3 개 중 2 개만 닫습니다. LinearLayout.

편집 당신의 버튼이 하단에 표시되는 이유는 이것이다 :

<RelativeLayout 
    android:id="@+id/relativeLayout1" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_weight="1" > 
</RelativeLayout> 

나는이 응용 프로그램에서 제공 어떤 목적 모르겠지만, 그 제거하면 문제가 해결됩니다.

+0

그것 의견이어야합니다. – Andrain

0

XML에서 아래의 선형 레이아웃 태그를 닫지 않았습니다. "<"의 LinearLayout 안드로이드 : ID = "@ + ID/linearLayout2는" 안드로이드 : layout_width = "fill_parent" 안드로이드 : layout_height = "20dp" 안드로이드 : "오리엔테이션 ="수평 ">"

0

교체하여 xml (다음 코드 포함)

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

    <LinearLayout 
     android:id="@+id/linearLayout1" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:orientation="vertical" 
     android:weightSum="10" > 

     <TextView 
      android:id="@+id/secondLine" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:textSize="20sp" /> 

     <Button 
      android:id="@+id/Button1" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:text="HelloWord" /> 
    </LinearLayout> 

    <LinearLayout 
     android:id="@+id/linearLayout2" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:orientation="horizontal" 
     android:layout_marginTop="5dp" 
     android:weightSum="10" > 

     <TextView 
      android:id="@+id/thirdLine" 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_weight="3.3" 
      android:background="#ff0000" 
      android:text="red" 
      android:textColor="#000000" 
      android:gravity="center" /> 

     <TextView 
      android:id="@+id/fourthLine" 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_weight="3.4" 
      android:background="#00ff00" 
      android:text="green" 
      android:textColor="#000000" 
      android:gravity="center" /> 

     <TextView 
      android:id="@+id/fifthLine" 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_weight="3.3" 
      android:background="#0000ff" 
      android:text="blue" 
      android:textColor="#000000" 
      android:gravity="center"/> 

    </LinearLayout> 

</LinearLayout> 

희망이 있으시면 도움이 될 것입니다.

관련 문제