我在這個問題上花了數小時,希望有人能幫助我。 對不起,如果問題是愚蠢的,我是相當新的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" />
我已經照顧的代碼爲這個按鈕,它工作得很好,但我不管理在我的屏幕底部顯示它。
我想它與屏幕的總體佈局有關。我不得不承認,我完全失去了嵌套在一起的一系列佈局,我不明白究竟在做什麼。
如果有幫助,我已經設法在屏幕頂部顯示我的按鈕,即使在我的廣告橫幅下方也是如此。但不在底部。
也沒有什麼幫助,我想佈局的一個佔據了整個heightspace(滾動視圖?),生活0高度,我想添加按鈕...
非常感謝您的時間和如果你能幫助我!
嘿,感謝回答,你說明到底是哪行,我應該包括這個LinearLayout中? – Don
檢查它我修改了它 – Samer
對不起,如果我的評論不清楚:我的意思是我的代碼應該包括你的代碼在哪裏?在哪一行? – Don