0

これが私のモバイルアプリのスクリーンショットです。下部のこの黒いスペースが良くないように見えるため、下部の中央にある「カテゴリの管理」ボタンを調整するにはどうすればよいですか。

ここに画像の説明を入力

これが私のレイアウトファイルです。

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/layout_root"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <ListView
        android:id="@+id/listCategory"
        android:layout_width="fill_parent"
        android:layout_height="0dip"
        android:layout_weight="0.9"
        android:background="#FFFFFF"
        android:gravity="top" />

    <Button
        android:id="@+id/btnManageCategory"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:onClick="onButtonClick"
        android:text="Manage Category" 
        android:gravity="center"
        />

</LinearLayout>
4

4 に答える 4

0

を使用してみてくださいweights。あなたが望むものを得るために数字をいじる必要があるかもしれませんが、ListView.8weightと .2 のButton. 両方heightの値を必ず指定してください。0dp何かのようなもの

  <ListView
    android:id="@+id/listCategory"
    android:layout_width="fill_parent"
    android:layout_height="0dip"
    android:layout_weight="0.8"
    android:background="#FFFFFF"
    android:gravity="top" />

<Button
    android:id="@+id/btnManageCategory"
    android:layout_width="fill_parent"
    android:layout_height="0dp"
    android:onClick="onButtonClick"
    android:text="Manage Category" 
    android:gravity="center"
    android:layout_weight="0.2"   
    />
于 2013-09-18T12:54:20.050 に答える
0
// try this
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/layout_root"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <ListView
        android:id="@+id/listCategory"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:background="#FFFFFF" />

    <Button
        android:id="@+id/btnManageCategory"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:onClick="onButtonClick"
        android:text="Manage Category"
        android:gravity="center"/>

</LinearLayout>
于 2013-09-18T12:59:11.697 に答える
0
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/layout_root"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <ListView
        android:id="@+id/listCategory"
        android:layout_width="fill_parent"
        android:layout_height="0dip"
        android:layout_weight="1"
        android:background="#FFFFFF"
        android:gravity="top" />
    <View
         android:id="@+id/view"
        android:layout_width="fill_parent"
        android:layout_height="0dip"
        android:layout_weight="1">
    </View>

    <Button
        android:id="@+id/btnManageCategory"
        android:layout_width="fill_parent"
        android:layout_height="0dp"
         android:layout_weight="1"
        android:onClick="onButtonClick"
        android:text="Manage Category" 
        android:gravity="center"


        />

</LinearLayout>
于 2013-09-18T12:51:14.390 に答える
0

これを試して :

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/layout_root"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical" >

<ListView
    android:id="@+id/listCategory"
    android:layout_width="fill_parent"
    android:layout_height="0dip"
    android:layout_weight="0.9"
    android:background="#FFFFFF"
    android:gravity="top" />

<Button
    android:id="@+id/btnManageCategory"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:onClick="onButtonClick"
    android:text="Manage Category" 
    android:gravity="center"
    />

</LinearLayout>
于 2013-09-18T12:52:54.580 に答える