2011.
07.
25
18:17:14
今回はレイアウト用XMLのお話です。
まずは一番基本部分、スクロールバーってどーやって使うの(--?なところ。
ひと言で言えばスクロールさせたい場所を囲ってやれば良いのです。
横スクロールバーは例えばこんな感じφ(--)
<HorizontalScrollView
android:id="@+id/horizontalScrollView1"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
>
<LinearLayout android:id="@+id/linearLayout2"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
~うんちゃらかんちゃら~
</LinearLayout>
</HorizontalScrollView>
「<HorizontalScrollView>~</HorizontalScrollView>」ですね。
ポイントは「<LinearLayout>~</LinearLayout>」。
「<HorizontalScrollView>~</HorizontalScrollView>」の間に
複数要素置こうとすると怒られてしまいます。
一旦「<LinearLayout>~</LinearLayout>」等を置いて
その中でボタンとかテキストとかを配置したってください。
縦スクロールバーは例えばこんな感じφ(--)
<ScrollView
android:id="@+id/scrollView1"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
>
<LinearLayout android:id="@+id/linearLayout2"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
~うんちゃらかんちゃら~
</LinearLayout>
</ScrollView>
「<ScrollView>~</ScrollView>」ですね。
あとは横スクロールバーと同じです。
まずは一番基本部分、スクロールバーってどーやって使うの(--?なところ。
ひと言で言えばスクロールさせたい場所を囲ってやれば良いのです。
横スクロールバーは例えばこんな感じφ(--)
<HorizontalScrollView
android:id="@+id/horizontalScrollView1"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
>
<LinearLayout android:id="@+id/linearLayout2"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
~うんちゃらかんちゃら~
</LinearLayout>
</HorizontalScrollView>
「<HorizontalScrollView>~</HorizontalScrollView>」ですね。
ポイントは「<LinearLayout>~</LinearLayout>」。
「<HorizontalScrollView>~</HorizontalScrollView>」の間に
複数要素置こうとすると怒られてしまいます。
一旦「<LinearLayout>~</LinearLayout>」等を置いて
その中でボタンとかテキストとかを配置したってください。
縦スクロールバーは例えばこんな感じφ(--)
<ScrollView
android:id="@+id/scrollView1"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
>
<LinearLayout android:id="@+id/linearLayout2"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
~うんちゃらかんちゃら~
</LinearLayout>
</ScrollView>
「<ScrollView>~</ScrollView>」ですね。
あとは横スクロールバーと同じです。