#android #xml #android-relativelayout
#Android #xml #android-relativelayout
Вопрос:
Я пытаюсь создать дизайн, который я не могу понять, как это исправить. Я хочу сделать что-то похожее на это:http://i57.tinypic.com/2v8n5z9.jpg
Я попробовал somestuff (relativelayout), который не решил мой вопрос. может ли кто-нибудь объяснить мне, как это сделать?
У меня пока есть этот, но мне это не нравится так, как я хочу.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/content_bg" >
<include
android:id="@ id/include2"
layout="@layout/header" />
<include
android:id="@ id/include1"
layout="@layout/footer" />
<SeekBar
android:id="@ id/Seekbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@ id/include1"
android:layout_marginBottom="30dp"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:max="100" />
<ImageView
android:id="@ id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@ id/Seekbar"
android:layout_centerHorizontal="true"
android:layout_marginBottom="40dp"
android:src="@drawable/play_start" />
</RelativeLayout>
Редактировать, я исправил это сам
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/content_bg" >
<include
android:id="@ id/include2"
layout="@layout/header" />
<include
android:id="@ id/include1"
layout="@layout/footer" />
<SeekBar
android:id="@ id/Seekbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@ id/include1"
android:layout_marginBottom="30dp"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:layout_marginTop="10dp"
android:max="100" />
<ImageView
android:id="@ id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@ id/Seekbar"
android:layout_centerHorizontal="true"
android:src="@drawable/play_start" />
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_above="@ id/imageView1"
android:layout_alignParentLeft="true"
android:layout_below="@ id/include2"
android:layout_marginBottom="50dp" >
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:layout_marginBottom="100dp">
<ImageView
android:id="@ id/imageView2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:scaleType="fitStart"
android:src="@drawable/logo" />
</RelativeLayout>
</RelativeLayout>
Ответ №1:
LinearLayout, похоже, лучше соответствует вашим потребностям
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical">
<include
android:id="@ id/include2"
layout="@layout/header" />
<ImageView
android:id="@ id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="40dp"
android:src="@drawable/play_start" />
<SeekBar
android:id="@ id/Seekbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="30dp"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:max="100" />
<include
android:id="@ id/include1"
layout="@layout/footer" />
Просто установите поля по своему усмотрению, чтобы все выглядело так, как вы хотите
Ответ №2:
Найдено решение. Предполагается добавить больше макета в layouts, добавлено решение для ответа