0

Android インターフェイスの写真: http://tinypic.com/view.php?pic=avht6w&s=6

上の図に見られるように、白い listView の下部と上部に小さな境界線が必要です。問題は、tableRow を android:paddingBottom="20dp" に設定すると、境界線が下部に表示されないことです。リストビューの高さが十分に大きい場合、それ以降は何も表示されないようです (理解するには、以下のコード例を参照してください)。

私は問題を解決するためにいくつかの異なるアプローチをテストしました.1つは次のTableRow(境界線のtableRow)でpaddingBottom属性を設定していますが、listViewの高さが画面の高さと正確であり、大きくない場合にのみ機能します.

listView の高さを 415dp のような固定数に設定するのはなぜですか? まあ、それは私が解決する方法がわからない別の問題によるものです。たとえば、listViews の高さを fill_parent に設定すると、背景はリスト内の項目数だけをカバーします。私は常にリストの背景をインターフェイスの下部から 20 dp まで埋めたいと思っています。

アイテムで満たされていない場合でも、下部に境界線を表示し、リストの背景を常に表示する方法について誰かがアイデアを持っている場合は、アイデアを投稿してください! /どうもありがとう!

<?xml version="1.0" encoding="utf-8"?>

<TableLayout 
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="@drawable/orginalbild"
android:gravity="center|top"
android:stretchColumns="1"
android:weightSum="1.0" 
android:fillViewport="true">

<TableRow
    android:background="#000000"
     >
<TextView
    android:layout_marginTop="0.15dp"
    android:layout_width="fill_parent"
    android:layout_height="2dp"
    android:background="#999999"
     android:layout_weight="1">
</TextView>


</TableRow>


<TableRow
    android:background="#999999"

    >
<TextView
    android:background="#999999"
    android:id="@+id/show_task_feedback_title"
    android:layout_width="0dip"
    android:layout_height="28dp"
    android:layout_weight="0.8"
    android:text="@string/LatestFeedbackTitle"
    android:textColor="#ffffff"
    android:textSize="17dp"
    android:shadowColor="#FFFFFF"
    android:layout_marginBottom="0.15dp"
    android:textAppearance="?android:attr/textAppearanceMedium"> 
    </TextView>

   <TextView

        android:layout_width="0dip"
        android:layout_height="28dp"
        android:layout_gravity="center"
        android:layout_weight="0.08"  >
    </TextView>


 <Button
        android:id="@+id/latest_feedback_help_button"
        android:layout_width="0dip" 
        android:layout_height="28dp"
        android:layout_gravity="center"
        android:background="@drawable/help_button"
        android:layout_weight="0.12"
        android:layout_marginBottom="0.15dp"
         />

</TableRow>

<TableRow
android:background="#212421">
<TextView
    android:layout_width="fill_parent" 
    android:layout_height="1dp"
    android:background="#ffffff"
    android:layout_marginTop="0.15dp"
    android:layout_weight="1">
</TextView>
</TableRow>   



<TableRow>
<TextView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_weight="0.25" />
</TableRow> 


<TableRow
android:paddingLeft="24dp"
android:paddingRight="24dp">  <--------THE BLACK BRODER AT THE TOP OF THE LISTVIEW

           <TextView
                android:background="#000000"
                android:layout_width="0dip"
                android:layout_height="0.5dp"
                android:layout_weight="1" >
            </TextView>

         </TableRow>

 <TableRow
android:paddingLeft="24dp"
android:paddingRight="24dp"
android:paddingBottom="20dp" <------(paddingBottom attribute which causes the problem)
>
       <ListView

                android:background="#ffffff"
                android:id="@+id/bookmarks_list"
                android:layout_width="0dip"
                android:layout_height="415dp"
                android:gravity="left"
                android:layout_weight="1"
               />
       </TableRow>

  <TableRow>  <---THE BLACK BRODER AT THE BOTTOM OF THE LISTVIEW(not being displayed)

      <TextView
                android:background="#000000"
                android:layout_width="0dip"
                android:layout_height="0.5dp"
                android:layout_weight="1" >
            </TextView>
        </TableRow>

</TableLayout>
4

1 に答える 1

0

これが役立つかどうかを確認してください。

<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/orginalbild"
    android:fillViewport="true"
    android:gravity="center|top"
    android:orientation="vertical"
    android:stretchColumns="1"
    android:weightSum="1.0" >

    <TableRow android:background="#000000" >

        <TextView
            android:layout_width="fill_parent"
            android:layout_height="2dp"
            android:layout_marginTop="0.15dp"
            android:layout_weight="1"
            android:background="#999999" >
        </TextView>
    </TableRow>

    <TableRow android:background="#999999" >

        <TextView
            android:id="@+id/show_task_feedback_title"
            android:layout_width="0dip"
            android:layout_height="28dp"
            android:layout_marginBottom="0.15dp"
            android:layout_weight="0.8"
            android:background="#999999"
            android:shadowColor="#FFFFFF"
            android:text="@string/LatestFeedbackTitle"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:textColor="#ffffff"
            android:textSize="17dp" >
        </TextView>

        <TextView
            android:layout_width="0dip"
            android:layout_height="28dp"
            android:layout_gravity="center"
            android:layout_weight="0.08" >
        </TextView>

        <Button
            android:id="@+id/latest_feedback_help_button"
            android:layout_width="0dip"
            android:layout_height="28dp"
            android:layout_gravity="center"
            android:layout_marginBottom="0.15dp"
            android:layout_weight="0.12"
            android:background="@drawable/help_button" />
    </TableRow>

    <TableRow android:background="#212421" >

        <TextView
            android:layout_width="fill_parent"
            android:layout_height="1dp"
            android:layout_marginTop="0.15dp"
            android:layout_weight="1"
            android:background="#ffffff" >
        </TextView>
    </TableRow>

    <TableRow>

        <TextView
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_weight="0.25" />
    </TableRow>

    <TableRow
        android:paddingTop="0.5dp"
        android:paddingBottom="0.5dp"
        android:background="#000000"
        android:layout_marginLeft="24dp"
        android:layout_marginRight="24dp"
        android:layout_marginBottom="20dp"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >

        <ListView
            android:id="@+id/bookmarks_list"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:background="#ffffff"
            android:gravity="left"
            android:entries="@array/listitems" />
    </TableRow>

</TableLayout>
于 2012-07-31T20:34:11.520 に答える