상대적 레이아웃에서 약간 이상한 동작을 관찰합니다.이유없이 편집 텍스트 변경
이 초기 상태이다
중도 :
<EditText
android:id="@+id/bleedCount"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="@+id/abrMult"
android:layout_below="@+id/textView4"
android:layout_marginRight="10dp"
android:ems="10"
android:inputType="number"
>
<requestFocus />
</EditText>
<TextView
android:id="@+id/abrMult"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="@+id/abrSubmit"
android:layout_alignBaseline="@+id/abrSubmit"
android:layout_marginRight="10dp"
android:text="x12" />
<Button
android:id="@+id/abrSubmit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/textView4"
android:layout_alignParentRight="true"
android:text="Calculate" />
드롭 다운에서 onItemSelected
에서 그것 같이 변경되고 :
abrSubmit.setText(pos == 1 ? "Calculate" : "Submit");
abrMult.setVisibility(pos == 1 ? View.VISIBLE : View.GONE);
bleedCount.setHint(pos == 1 ? "# of Meow/month" : "# of Meow/year");
이 변신 :
두 번째 그림에서 EditText bleedCount
의 길이가 길어집니다. bleedCount.getHeight()
의 값이 72에서 95로 변경되고 있으며 그 원인을 이해할 수 없습니다. 글고 x12
가 전경의 게재 한 결과, 폭의 변경시
문제점을 재현하려고 시도했습니다. 게시 한 코드를 복사/붙여 넣기하고 Cupcake 에뮬레이터에서 실행하고 아무런 문제가 보이지 않으면 editText 상자가 같은 높이를 유지합니다. 어떤 Android 버전을 사용하고 있습니까? EditText 상자를 사용자 정의하기 위해 다른 작업을 수행하고 있습니까? 특정 테마를 사용하고 있습니까? – Matthieu
왜 3 가지 요소 (텍스트, 텍스트보기, 버튼 편집)에 대해 가중치를 사용하지 않고 가중치가있는 가로 선형 레이아웃에 넣으십시오. –