【问题标题】:Android design xml playerAndroid设计xml播放器
【发布时间】:2014-07-03 20:46:04
【问题描述】:

我正在尝试制作一个我不知道如何修复它的设计。我想要的是制作类似于这个的东西:http://i57.tinypic.com/2v8n5z9.jpg

我尝试了一些东西(相对布局),但没有解决我的问题。有人可以解释我该怎么做吗?

到目前为止我有这个,但它不像我想要的那样。

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

【问题讨论】:

    标签: android xml android-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】:

      找到了解决办法。应该在layout中添加更多的layout,添加解决方案来回答

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-11-21
        • 2022-09-30
        • 1970-01-01
        • 2012-03-16
        • 1970-01-01
        相关资源
        最近更新 更多