0

Eclipse Android: 私は 4 つの ImageButtons を持っていて、同じ幅で生の画面の下ボタンを使用し、画面の幅を一緒に埋めたいと思っています。誰でも私がこれを行うのを手伝ってくれますか?

4

1 に答える 1

1

水平方向でLinearLayout を使用しweightSum=4、このレイアウト ボタンに重み 1 で配置できます。ここに例を示します。

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal"
    android:weightSum="4" >

    <Button
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1" />

    <Button
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1" />

    <Button
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1" />

    <Button
        android:layout_width="0dp"
        android:layout_height="wrap_content"
       android:layout_weight="1" />

</LinearLayout>
于 2013-07-26T10:55:54.373 に答える