0

私はこの問題に何時間も費やしてきました。誰かが私を助けてくれることを願っています。質問がばかげている場合は事前に申し訳ありませんが、私はAndroid開発にかなり慣れていません。また、すでに多くのコードを生成しているアプリビルダーを使用しています。私は基本的に私が望むものでこのコードを微調整しようとしています...

問題はxmlレイアウトに関するものであり、コードが関係しているとは思いません。この画面の下部に簡単なボタンを表示したいと思います。

だから私はグリッドにボタンのグループを構築するこの画面を持っています。上部にも広告バナーを表示しています。これらのボタンのパラメーターは、Webインターフェース上のWebアプリビルダーを介して指定されます。これらのボタンは問題ありません。これらは、以下のこの画面レイアウトで正しく表示されます。

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

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:id="@+id/containerView"
android:background="@android:color/transparent"    
android:padding="0dip"
android:layout_margin="0dip"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">

<com.google.ads.AdView android:id="@+id/adView"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
                     ads:adUnitId="123"
                     ads:adSize="SMART_BANNER"
                     ads:testDevices="123"
                     ads:loadAdOnCreate="true">
</com.google.ads.AdView>



    <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/verticalScrollView" 
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent">

        <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/tableLayout" 
            android:layout_width="fill_parent" 
            android:layout_height="fill_parent">
        </TableLayout>

    </ScrollView>

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/containerViewHorizontal"
            android:background="@android:color/transparent"    
            android:padding="0dip"
            android:layout_margin="0dip"
            android:orientation="horizontal"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent">

            <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
                    android:id="@+id/containerViewHorizontalBottom"
                    android:background="@android:color/transparent"    
                    android:padding="0dip"
                    android:layout_margin="0dip"
                    android:orientation="vertical"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content">

                <HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android"
                    android:id="@+id/horizontalScrollView" 
                    android:layout_width="fill_parent" 
                    android:layout_height="wrap_content">

                    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
                        android:id="@+id/containerHorizontalButtons"
                        android:background="@android:color/transparent"    
                        android:padding="0dip"
                        android:layout_margin="0dip"
                        android:orientation="horizontal"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content">

                    </LinearLayout>

                </HorizontalScrollView> 

            </LinearLayout>

    </RelativeLayout>

今私がやろうとしているのは、このボタンのグループの下部に、Webアプリビルダーで生成されたリストに属していないが手動で作成されたボタンを追加することです。

<Button
android:id="@+id/bmenu2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"     
android:text="Button" />

このボタンのコードはすでに処理しました。うまく機能しますが、画面の下部に表示できません。

画面の一般的なレイアウトと関係があると思います。互いにネストされた一連のレイアウトで完全に失われていることを認めなければなりません。何が何をしているのか正確にはわかりません。

それが役に立ったら、広告バナーのすぐ下でも、画面の上部にボタンを表示することができました。しかし、一番下ではありません。

また、それが役立つ場合は、レイアウトの1つが高さスペース全体(スクロールビュー?)を占め、追加したいボタンの高さが0になっていると思います...

お時間をいただき、ありがとうございました。

4

1 に答える 1

1

Juyt は、リストとボタンの相対レイアウトではなく、線形レイアウトを実装します。次に、リストの高さを 0dp、重みを 1 にします。ボタンには次のような属性があります。

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<ListView
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="1" >
</ListView>

<Button
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="Button" />

</LinearLayout>
于 2012-09-19T14:11:20.273 に答える