0

有料版と無料版があるアプリに取り組んでいます。どちらのバージョンも地図を表示しますが、現時点では Google マップまたは OSM か​​ら派生した地図のいずれかであり、それぞれに異なる地図フラグメントをロードすることでそれらの切り替えを処理します。常に表示する必要がある 2 つのボタンもあります。Honeycomb 以降では、分割アクション バーでこれらのボタンのアクションを作成することでこれを処理できますが、下位互換性の理由から、Android のバージョンが Honeycomb より前の場合は、フレーム レイアウトを使用してこれらのボタンをマップの上に表示することもできます。 .

有料版では、マップは利用可能なすべての画面スペースを占有します。問題は、無料版の場合、広告バナーを上部に、会社の Web サイトにリンクする画像を下部に配置し、その間に地図の断片を配置する必要があることです。現在、プレースホルダーとしてそれぞれに TextView を使用しています。上部にあるものは表示できますが、下部にあるものは表示されません。

ここに私のレイアウトファイルがあります:

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

<TextView
        android:id="@+id/advertisement"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="Advertisement placeholder" 
        android:layout_gravity="center_horizontal"
        android:visibility="gone"/>


<FrameLayout 
    android:layout_width="match_parent"
    android:layout_height="fill_parent"
    >

    <LinearLayout
        android:id="@+id/map_fragment_container"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"/>

    <LinearLayout 
        android:id="@+id/map_screen_button_container"
        android:orientation="horizontal"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:background="#00000000"

        android:paddingBottom="22dp"
        android:gravity="center_horizontal"
        android:visibility="gone">

            <Button
                android:id="@+id/main_button_normal"
                android:onClick="callbackRequest"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:drawableLeft="@drawable/menu_callback_request"
                android:layout_gravity="bottom"/>

            <Button
                android:id="@+id/main_button_emergency"
                android:onClick="emergencyCallbackRequest"
                android:layout_width="wrap_content"             
                android:layout_height="wrap_content"
                android:drawableLeft="@drawable/menu_emergency_request" 
                android:layout_gravity="bottom"/>
    </LinearLayout>

</FrameLayout>

<TextView
        android:id="@+id/company_banner"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="Company Banner Placeholder" 
        android:layout_gravity="center_horizontal"
        android:visibility="gone"/>


</LinearLayout>

私の MapScreen アクティビティの onCreate() メソッドでは、実行中のバージョンが無料バージョンの場合、次のことも行います。

    TextView advertisement = (TextView) findViewById( R.id.advertisement );
TextView companyBanner = (TextView) findViewById( R.id.company_banner );

advertisement.setVisibility( View.VISIBLE );
companyBanner.setVisibility( View.VISIBLE );

FrameLayout 内でレイアウトがどのように表示されるかを損なうことなく、両方の TextView オブジェクトが表示されるようにこのレイアウト ファイルを変更するにはどうすればよいですか?

4

2 に答える 2