2011-06-28 11 views
0

私は、下のボタンで背景の地図の写真を持っています。このスクロールを水平スクロールバーで行いたいと思います。開始時に画面の右側に揃えられていて、そこに保持したいと思います。これは可能ですか?水平スクロールバーでボタンを移動するにはどうすればよいですか?

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" android:id="@+id/mapBackground"> 
<HorizontalScrollView android:id="@+id/horizontalScrollView1" 
    android:layout_height="fill_parent" 
    android:scrollbars="none" android:layout_width="fill_parent"> 
<LinearLayout android:layout_width="fill_parent" android:id="@+id/linearLayout1" 
    android:background="@drawable/large_map" android:layout_height="fill_parent" 
    android:orientation="vertical" 
    android:gravity="bottom"> 
<LinearLayout android:id="@+id/linearLayout4" android:layout_width="fill_parent" 
    android:layout_height="400dp"> 
</LinearLayout> 
<LinearLayout android:layout_height="wrap_content" android:id="@+id/linearLayout5" 
    android:layout_width="320dp" android:gravity="right"> 
<Button android:background="@drawable/bt_play_circle" 
    android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/playButton"></Button> 
</LinearLayout> 
</LinearLayout> 
</HorizontalScrollView> 
</LinearLayout> 
+0

理解のためにサンプルのレイアウトイメージを提供できますか? – Sujit

+0

を忘れてしまった。今追加されました。私はボタンの円が画面の右側に残るようにしたい – Robin

答えて

1

スクロール中にボタンが地図の右側に残りますか? ボタンをHorizo​​ntalScrollViewの外側に配置します。 たとえば、LinearLayoutの代わりにRelativeLayoutを使用できます。

<RelativeLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
> 
    <HorizontalScrollView> 
    ... 
    </HorizontalScrollView> 
    <Button 
    android:id="@+id/playButton" 
    android:background="@drawable/bt_play_circle" 
    android:layout_height="wrap_content" 
    android:layout_width="wrap_content" 
    android:layout_alignParentRight="true" 
    /> 

</RelativeLayout> 
+0

完璧です。ありがとうございました! – Robin

関連する問題