2011-06-19 18 views
0

私が理解できないリスト項目のレイアウトに問題があります。私はリスト項目の高さを70dpに設定しますが、40dpの高さのコンテンツしか持たない場合は、android:layout_heightで設定した値を自動的に無視して、代わりに高さとしてwrap_contentのように見えます。代わりにwrap_contentを使用して、設定された高さを無視するリスト項目

私はリストの外でexakt同じレイアウトを使用する場合、それは意図したとおりに動作します。

以下は私のリストのリスト項目のレイアウトです。

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:orientation="vertical" 
android:layout_height="70dip" 
android:layout_width="fill_parent"> 

<TextView android:id="@+id/name" 
    android:layout_height="wrap_content" 
    android:layout_width="wrap_content" 
    style="@style/NormalText"/> 

<TextView android:id="@+id/description" 
    android:layout_height="wrap_content" 
    android:layout_width="wrap_content" 
    style="@style/VerySmallLightText"/></LinearLayout> 

私のコードをよりよく反映するように編集しました。私はそこにスタイルの属性をいくつか持っているので、私は誤って手動でここにそれを結びつけたときに誤ってタイプミスをしたのです。

答えて

0

あなたのlinearlayout属性は次のとおりです android:height = '70dip'はIDEチェックを通過できますか?

+0

私は私の一部にここ –

1

高さだけでなく、線形レイアウトのlayout_heightを試しましたか?私の投稿のコードを更新

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:orientation="vertical" 
android:layout_height="70dp"* 
android:layout_width="fill_parent"> 
+0

タイプミスを、コードを書いたとき、それは、私はofcourseの私のコードだけ誤植layout_heightていました:9は今これを反映する私のポストを変更 –

関連する問題