画像が背景として塗りつぶされた画面と、画像上に浮かぶ3つのボタンが必要です。私はxmlでこの罰金を作成し、それは私が望むことを垂直方向で行います。しかし、私はスクロールビューを追加しようとしており、これらの要素を正しく組み合わせる方法については非常に混乱しています。様々な試みの後、私は背景画像と浮動ボタンのスクロール
<?xml version="1.0" encoding="utf-8"?>
<ScrollView android:layout_height="fill_parent"
android:layout_width="fill_parent" android:id="@+id/home_container"
xmlns:android="http://schemas.android.com/apk/res/android">
<ImageView android:src="@drawable/alert"
android:layout_height="fill_parent" android:layout_width="fill_parent"
android:scaleType="fitCenter" android:clickable="true"
android:enabled="true" />
<LinearLayout android:layout_width="fill_parent"
android:paddingBottom="25px" android:paddingLeft="25px"
android:orientation="vertical" android:paddingTop="90px" android:id="@+id/toplinear"
android:layout_height="fill_parent" android:paddingRight="25px"
android:gravity="top">
<Button android:layout_width="fill_parent" android:textSize="20dp"
android:id="@+id/startprogrambutton" android:paddingBottom="12dp"
android:text="@string/text1" android:layout_height="wrap_content"
android:paddingTop="12dp"></Button>
<Button android:layout_width="fill_parent" android:textSize="20dp"
android:id="@+id/button1" android:paddingBottom="12dp"
android:layout_marginTop="10dp" android:background="@drawable/webview_buttons"
android:text="@string/text2" android:layout_height="wrap_content"
android:paddingTop="12dp"></Button>
<Button android:layout_width="fill_parent" android:textSize="20dp"
android:id="@+id/button2" android:paddingBottom="12dp"
android:layout_marginTop="10dp" android:background="@drawable/webview_buttons"
android:text="@string/text3" android:layout_height="wrap_content"
android:paddingTop="12dp"></Button>
<Button android:layout_width="fill_parent" android:textSize="20dp"
android:id="@+id/button3" android:paddingBottom="12dp"
android:layout_marginTop="10dp" android:background="@drawable/webview_buttons"
android:text="@string/text4" android:layout_height="wrap_content"
android:paddingTop="12dp"></Button>
</LinearLayout>
、以下に示すステージは今scrollviewとエラーが唯一の子を含めることができ、それに達しました。再配置する方法はありますか?私は自分のイメージとフローティングボタンを一緒にスクロールすることができますか?
それはerrorring停止しますが、今の画像は背景が、ボタンの上の別々の要素ではありません。ここに公式ドキュメントを参照してください。スクロールしなくてもOKだったときは、フレームレイアウトのすべてを持っていたことを忘れてしまった。私が理解しているように、スクロールビューはフレームレイアウトです。 – ron
ボタンを使用した線形レイアウトには、android:background = "@ drawable/alert"属性を使用します。 imageViewを削除します。 、はい、それをframeLayoutに置き換えることもできます。そのフレームをスクロールビューの内側に配置します。 –
ありがとうYashwanth - 背景attr didiそれ。 – ron