2

ユーザーをある地点から別の地点にナビゲートするスキーヤーとスノーボーダー向けの Android アプリに取り組んでいます。

マップを表示するために、Mapsforge-Version 0.4.0 を使用しています。

マップ上にいくつかのレイヤーを追加しましたが、Imagebutton を追加したいのですが、すべての試行が失敗しました。Xmlファイルなしでそれを行う方法についていくつかのアイデアはありますか?

初めての質問なので、何か情報を忘れていたら教えてください。

4

1 に答える 1

3

ステップ 1 : コンテンツ ビューを mapView に設定しないようにする

   // setContentView(mapView);


ステップ 2 : ボタンを linearlayout
に追加する 単に linearlayout を relativelayout に追加するだけです

<RelativeLayout
    android:id="@+id/rlMap"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <LinearLayout
        android:id="@+id/llControls"
        android:orientation="horizontal"
        android:layout_width="fill_parent"
        android:layout_height="50dp"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true">

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

    </LinearLayout>

</RelativeLayout>

ステップ 3: RelativeLayout を見つけて、それに mapView オブジェクトを追加します。

RelativeLayout rlMap = (RelativeLayout) findViewById(R.id.rlMap);
rlMap.addView(mapView,0);
于 2014-10-02T08:07:14.050 に答える