다음과 같은 레이아웃과 전화가 있습니다. 한 번에이 매우 동일한 코드가 부모 레이아웃의 너비 인 탭을 채 웁니다. 지금은 그렇지 않으며 이유를 알 수 없습니다. 그것은 내가 최신 버전을 공개하지 못하게합니다. 모든 입력이 환영됩니다.Android TextView가 너비를 채우지 못하는 이유는 무엇입니까?
section_title.xml :
여기<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/seasonTitle"
android:padding="3dip"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="#FFFFFFFF"
android:textSize="14sp"
android:textStyle="bold"
android:maxHeight="26sp"
android:background="#FFCC3333"
/>
가 호출되는 방식의 미리보기입니다 :
TextView titleTv = (TextView)mInflater.inflate(R.layout.section_title, null);
titleTv.setText(titleText);
mMergeAdapter.addView(titleTv);
감사합니다! 이 같은 부모없이보기를 부풀려
상위 레이아웃 매개 변수를 확인 했습니까? 예 : LinearLayout 인 경우, orientation는 "horizontal"로 설정할 수 있습니다. – 87element
전체 너비가 걸리는 다른보기가있을 수 있습니다. – Salw
네가 맞다는 것이 밝혀졌다. 내가 부모로부터 제거한 또 다른 관점 때문에 더 이상 전폭을 사용하지 않는 부모였다. 제거 된 뷰는 전체 너비로 강제되고 이제는 부모가 전체 너비가 아니게되었습니다. –