私のアプリケーションでは、5 つのボタンを含む相対レイアウトを作成しましたが、同じレイアウトを他のレイアウトで背景として使用したいと考えています。コードを試していますandroid:background+"@layout/dashboard"
が、Eclipse でエラーが表示されます。スクロール ビューを実装して、ダッシュボード以外のすべての要素を呼び出すことができるように、そのレイアウトをParent Bottomとして表示したいと考えています。次のことをお知らせください。
- 背景として別のレイアウトを追加するにはどうすればよいですか
- そのレイアウトを alignParentBottom に設定するにはどうすればよいですか
- ダッシュボードが静的なままで、残りの要素がスクロールできるように、scrollView を変更するにはどうすればよいですか?
dashboard.xml のコード
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<Button
android:id="@+id/b1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
android:text="Home" />
<Button
android:id="@+id/b2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/b1"
android:layout_alignParentBottom="true"
android:text="Explore" />
<Button
android:id="@+id/b3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:text="MIC" />
<Button
android:id="@+id/b4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="@+id/b5"
android:layout_alignParentBottom="true"
android:text="Msngr" />
<Button
android:id="@+id/b5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:text="Profile" />
</RelativeLayout>
showdashboard.xml のコード
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@layout/dashboard" >
</LinearLayout>
私が得ているエラーは次のとおりです。
ファイル C:\Users\%username%\Documents\eclipse\CustomList\res\layout\dashboard.xml の解析に失敗しました 例外の詳細は [ウィンドウ] > [ビューの表示] > [エラー ログ] に記録されます
助けてください..