0

現在、画面の正確なサイズに応じて、下の2つの画像のいずれかのようなレイアウトになっています。その上に、Play Game!ボタンが上にあり、もう一方の著作権テキストが上にあります。

ここに画像の説明を入力してください ここに画像の説明を入力してください

私がやろうとしているのは、アドビューと上部のテキストボックス/レイアウトの上部の間に画像を配置することです。画面サイズの違いに応じて、一番上に表示されるエントリは異なる場合があります。この問題をまったく起こさないようにしたいのですが...imageviewの下に配置する方法は知っていますが、両方のアイテムの上に配置することはできません。

これまで、下部の変数を囲むrelativeLayoutを試し、画像にその上であるがAdViewの下にあるように指示しました。問題は、wrap_contentに設定されていて、以下の値がそれほど高くないにもかかわらず、RelativeViewの上部が上部にクリアになることです。

また、テキストの上部をボタンの上部に揃えるか、またはその逆を検討しましたが、上部のボタンが大きくなる可能性のある、醜い可能性のあるインターフェイス、またはその一部が頭に浮かびます。著作権テキストが隠されています。

だから、私は2つの解決策のうちの1つを探しています。画像がボタンとテキストの2つのアイテムの上にあることを示す方法、またはラップされた値のすぐ上になるようにコンテキストをラップする方法。

これが私がテストした関連するXMLコードです。

<RelativeLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent" 
  android:orientation="vertical">
  <com.google.ads.AdView android:id="@+id/adView" ads:loadAdOnCreate="true" ads:adSize="BANNER" ads:adUnitId="@string/admob_unit_id" android:layout_width="wrap_content" android:layout_height="wrap_content" ></com.google.ads.AdView>
  <ImageView android:src="@drawable/start_logo" android:gravity="center" android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/logo_view" android:layout_below="@+id/adView" android:layout_above="@+id/buttons_copyright"></ImageView>
  <RelativeLayout android:id="@+id/buttons_copyright" android:layout_width="fill_parent" android:layout_alignParentLeft="true" android:layout_alignParentBottom="true"  android:layout_alignParentTop="false" android:layout_height="wrap_content">
   (NOTE: LOTS OF STUFF GOES HERE)
  </RelativeLayout>
</RelativeLayout>
4

1 に答える 1

4

私はあなたのために働くレイアウトを作りました-それはこのように見えます:編集:これを試してください...

ここに画像の説明を入力してください

このレイアウトを使用します(上部のボタンを広告に置き換えます)(前回の編集から少し変更して、別の相対レイアウトを使用します...)

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <Button
        android:text="Button"
        android:id="@+id/button1"
        android:layout_height="wrap_content"
        android:layout_width="match_parent"></Button>
    <TextView
        android:text="Version Text"
        android:layout_height="wrap_content"
        android:layout_width="fill_parent"
        android:layout_alignBaseline="@+id/instructions_button"
        android:layout_toLeftOf="@+id/instructions_button"
        android:layout_marginLeft="5dp" />
    <Button
        android:id="@+id/instructions_button"
        android:layout_width="wrap_content"
        android:text="Instructions"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:minWidth="100dp"
        android:layout_alignParentBottom="true" />
    <TextView
        android:text="Game Name Text"
        android:layout_height="wrap_content"
        android:layout_width="fill_parent"
        android:layout_alignBaseline="@+id/scores_button"
        android:layout_toLeftOf="@+id/scores_button"
        android:layout_marginLeft="5dp" />
    <Button
        android:id="@+id/scores_button"
        android:layout_width="wrap_content"
        android:text="High Scores"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:minWidth="100dp"
        android:layout_above="@+id/instructions_button" />
    <RelativeLayout
        android:id="@+id/copyright_layout"
        android:layout_above="@+id/scores_button"
        android:layout_height="wrap_content"
        android:layout_width="fill_parent">
        <TextView
            android:text="Copyright text goes here and goes on and on a bit and fills up a few lines and looks ok generally and keeps on going and going and going and going onto many lines longer thatn it should etct"
            android:textSize="10sp"
            android:layout_height="wrap_content"
            android:layout_width="fill_parent"
            android:layout_alignTop="@+id/play_button"
            android:layout_toLeftOf="@+id/play_button"
            android:layout_marginLeft="5dp" />
        <Button
            android:id="@+id/play_button"
            android:layout_width="wrap_content"
            android:text="Play Game!"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:minWidth="100dp"
            android:layout_above="@+id/scores_button" />
    </RelativeLayout>
    <ImageView
        android:layout_height="wrap_content"
        android:layout_width="fill_parent"
        android:id="@+id/imageView1"
        android:layout_margin="5dp"
        android:layout_above="@+id/copyright_layout"
        android:layout_below="@+id/button1"
        android:src="@drawable/map"
        android:scaleType="centerCrop" />
</RelativeLayout>
于 2011-06-03T22:42:57.863 に答える