私はここで夢中になります。私はこの仕事を1000回前に経験したことを誓います、そしてそれは今何も正しく振る舞っていないようです。私は愚かなことをしなければなりません。数日前、リストビューアイテムの背景が親を埋めずにリストビューアイテムの高さ全体に広がるという問題が発生していました。私はついに諦め、それを修正するために両方の高さをハードコーディングしました。今、私はアクティビティ全体の背景を設定し、画像が画面全体を覆うようにその親を塗りつぶそうとしています。このアクティビティはタブ内にあります。これがタブコントローラーのコードと私が問題を抱えているアクティビティです。
タブレイアウト:
<?xml version="1.0" encoding="utf-8"?>
<TabHost
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5dp">
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
</FrameLayout>
</LinearLayout>
</TabHost>
面倒な活動:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/background">
<RelativeLayout
android:id="@+id/localHeader"
android:layout_width="fill_parent"
android:layout_height="50dip"
android:background="@drawable/header2">
<Button
android:id="@+id/changeCityButton"
android:layout_width="80dip"
android:layout_height="30dip"
android:layout_marginRight="10dip"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:onClick="buttonChangeOnClickListener"
android:text="Change"
android:textColor="#FFFFFF"
android:background="@drawable/local_deal_redeem_button" />
<TextView
android:id="@+id/cityName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dip"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="@id/changeCityButton"
android:textSize="20dip"
android:textColor="#FFFFFF"
android:textStyle="bold"
android:shadowColor="#FF000000"
android:shadowDx="1"
android:shadowDy="1"
android:shadowRadius="1"/>
</RelativeLayout>
<ListView
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@id/localHeader"
android:fastScrollEnabled="true"
android:cacheColorHint="#00000000"
android:divider="@null"
android:dividerHeight="0px"/>
</RelativeLayout>
この問題は、新しいBionicでのみ発生しているようです。「@drawable/ background」は、リストビューが長い場合にのみ拡大されます。また、リストビューにアイテムがない場合は、何も表示されません。レイアウトからリッピングしてイメージビューにすることも試みましたが、それもうまくいきませんでした。どこかにwrap_contentタグがないようです。通常、これはBionicで厄介なことだと思いますが、ListViewの背景でこれらの問題がどのように発生したかを見ると、どこかで何かが台無しになっていると思います。助けてください!!
私のマニフェストにも:
<supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:resizeable="true" android:anyDensity="true"></supports-screens>
しかし、私はそれを削除しようとしました、そして私がその行にどんな値を入れても、それは私のアプリでは何もしません。
編集:画像を「fill_parent」スクロールビューに入れると、それに応じて背景が伸びることに気づきました。ただし、画面にListViewが含まれているため、このルートに進むことはできません。ここで何かが風変わりです。
編集2:リストビューを取り除いたところ、完全に機能しました。それはどういうわけかリストビューに関連しています。
編集3: ListViewの高さを「wrap_content」に設定することで問題を解決しました。「fill_parent」がこのデバイスでこの動作を引き起こした理由はわかりませんが、修正されたため、すべてが順調に進んでいます。私はさらに6時間自己回答できないので、誰かがこれを回答として入れたい場合は、正しいものとして選択します。みんな、ありがとう!