0

私はAndroidでViewflipperを作成する方法のチュートリアルに従おうとしました。すべてが機能しているように見えますが、これはレイアウトを変えたいということだけです。現時点では、3つのボタンとWebビューが含まれています。上部にある3つのボタンと、下部にあるWebビューです。ボタンを下に、Webビューを上に配置したいと思います。困っている初心者を助けてください!

<?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" >

<HorizontalScrollView
 android:id="@+id/main_horizontal_container"
 android:layout_width="fill_parent"
 android:layout_height="wrap_content" >

<RelativeLayout
 android:layout_width="fill_parent"
 android:layout_height="fill_parent" >

        <Button
            android:id="@+id/main_access_profile"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Profile"
            android:textSize="25dp" />

        <TextView
            android:id="@+id/main_blank_1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_toRightOf="@id/main_access_profile"
            android:text=""
            android:textSize="25dp" />

        <Button
            android:id="@+id/main_access_portfolio"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_toRightOf="@id/main_blank_1"
            android:text="Portfolio"
            android:textSize="25dp" />

        <TextView
            android:id="@+id/main_blank_2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_toRightOf="@id/main_access_portfolio"
            android:text=""
            android:textSize="25dp" />

        <Button
            android:id="@+id/main_access_history"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_toRightOf="@id/main_blank_2"
            android:text="History"
            android:textSize="25dp" />
    </RelativeLayout>
</HorizontalScrollView>

<ViewFlipper
    android:id="@+id/main_flipper"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_below="@id/main_horizontal_container" >

    <include
        android:id="@+id/main_test1"
        layout="@layout/test1" />

    <include
        android:id="@+id/main_test2"
        layout="@layout/test2" />

    <include
        android:id="@+id/main_test3"
        layout="@layout/test3" />
</ViewFlipper>

</RelativeLayout>

これがWebViewを含むtest1.xmlファイルです!

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/test1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >



<WebView
    android:id="@+id/webView1"
    android:layout_width="match_parent"
    android:layout_height="421dp" />

</LinearLayout>

ありがとう!

4

1 に答える 1

0

この例ではRelativeLayoutを使用しているため、位置を定義する属性を変更する必要があります。あなたのファイルではそれは行になります

android:layout_below="@id/main_horizontal_container"

ViewFlipperで。

変化する

android:layout_below

android:layout_above
于 2012-07-25T20:18:44.830 に答える