2010-06-08 6 views
1

저는 이상한 문제가 있습니다. 단추의 텍스트가 특정 동작에 따라 아래쪽으로 이동하는 이러한 단추가 있습니다. 예를 들어 선택 항목이있는 회 전자가 있고 선택 항목 중 하나는 일부 단추를 보이지 않게하고 다른 단추는 보이도록 만듭니다. 이 버튼을 선택하면 보이는 모든 버튼의 텍스트가 아래쪽으로 이동합니다. 그 밖의 것은 이동되지 않고 버튼에있는 텍스트 만 나타납니다. 나는이 1.5 시도한 및 괜찮아, 텍스트가 이동됩니다 있지만 2.1 문제가 있고 정말 그것을 알아낼 수 없습니다. 어떤 아이디어 나 도움도 좋을 것입니다. 감사.버튼 텍스트 시프트 문제가 있습니다.

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


<TableLayout android:id="@+id/testpracHeader" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_alignParentTop="true"> 
    <!-- android:background="#ff0000"--> 

    <TableRow> 
     <Spinner android:id="@+id/testprac_menu" 
      android:layout_width="200px" 
      android:layout_height="wrap_content"></Spinner> 
     <View android:id="@+id/header_space_buffer" 
      android:layout_width="40px" 
      android:layout_height="30px" 
      android:gravity="center"></View> 
     <Button android:text="New" 
      android:id="@+id/newInterval" 
      android:layout_width="80px" 
      android:layout_height="wrap_content"></Button> 
    </TableRow> 
</TableLayout> 

<TableLayout android:id="@+id/bottomStruct" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true"> 
    <TableRow> 
     <Button android:layout_width="80px" 
      android:text="Replay" 
      android:id="@+id/replay" 
      android:layout_height="wrap_content"></Button> 
     <Button android:id="@+id/playInterval" 
      android:text="Play" 
      android:layout_width="160px" 
      android:layout_height="wrap_content"></Button> 
     <Button android:text="Submit" 
      android:id="@+id/submit" 
      android:layout_width="80px" 
      android:layout_height="wrap_content"></Button> 
    </TableRow> 
</TableLayout> 

</RelativeLayout> 

내가 새로운 기능 testprac 회, 재생을 사용하고 제출 버튼이 보이지 않는 가서 플레이 버튼 (내가 원하는입니다) 표시됩니다 : 여기

파일의 XML입니다. 문제가 시작되는 것 같습니다. 재생 버튼의 텍스트가 완전히 사라졌고 (아마 낮은 곳으로 이동) 볼 수있는 다른 버튼으로 돌아 가면 아래에 표시된 문제가 발생합니다. 회 전자를 사용하기 전에 왼쪽이 문제이며, 오른쪽이 문제입니다. 나는 그것이 단지 이것을 일으키는 방적 자인지는 모른다.

The GUI before I invoke the spinner The GUI after I invoke the spinner

+0

의심되는 XML을 게시해야합니다. –

답변

0

RelativeLayout 안에 Spinner을 사용할 때 버그가 있다고 생각합니다. 루트 레이아웃을 LinearLayout으로 변경하려고하면 예상대로 작동합니다. 원래 레이아웃

변경 :

  1. 루트 레이아웃의 LinearLayout로 변경되었습니다.
  2. TableLayout 사이에 더미보기가 추가되어 상단과 상단이 분리되고 하단이됩니다.

참고 : this를 해결하는 동안 나는 질문을 발견했다. 비슷한 것처럼 보입니다.

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


<TableLayout android:id="@+id/testpracHeader" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content"> 
    <!-- android:background="#ff0000"--> 

    <TableRow> 
     <Spinner android:id="@+id/testprac_menu" 
      android:layout_width="200px" 
      android:layout_height="wrap_content"></Spinner> 
     <View android:id="@+id/header_space_buffer" 
      android:layout_width="40px" 
      android:layout_height="30px" 
      android:gravity="center"></View> 
     <Button android:text="New" 
      android:id="@+id/newInterval" 
      android:layout_width="80px" 
      android:layout_height="wrap_content"></Button> 
    </TableRow> 
</TableLayout> 

<View 
     android:layout_width="fill_parent" 
     android:layout_height="0dp" 
     android:layout_weight="1"/> 

<TableLayout android:id="@+id/bottomStruct" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content"> 
    <TableRow> 
     <Button android:layout_width="80px" 
      android:text="Replay" 
      android:id="@+id/replay" 
      android:layout_height="wrap_content"></Button> 
     <Button android:id="@+id/playInterval" 
      android:text="Play" 
      android:layout_width="160px" 
      android:layout_height="wrap_content"></Button> 
     <Button android:text="Submit" 
      android:id="@+id/submit" 
      android:layout_width="80px" 
      android:layout_height="wrap_content"></Button> 
    </TableRow> 
</TableLayout> 

</LinearLayout> 
0

텍스트는 버튼 내부 을 이동? 버그 일 수 있습니다. Android 2.2에서 사용해 보셨습니까?

+0

네, 버튼 안에서 바뀌 었습니다. 버튼의 배치와 그 밖의 모든 것은 여전히 ​​괜찮습니다. 나는 그것을 2.2에서 시험해야 할 것이다. 내가 사진을 제공 할 수 있는지 알게 될거야. – Fizz

+0

setVisibility()는이 버튼과 관련하여 호출하는 유일한 방법입니까? View.INVISIBLE 대신에 View.GONE을 사용해 보셨습니까? 이 오리엔테이션은 종속적입니까? – Shade

+0

View.GONE은 내가 원하는 것만은 아닙니다. 버튼을 그림에 표시된 것보다 훨씬 더 많이 움직 였지만 더 이상 그 문제가 없었습니다. android : layout_alignParentBottom 명령 버그가있을 수 있습니까? – Fizz

관련 문제