布局定位问题,自定义SlidingDrawer [英] Layout positioning problem with Custom SlidingDrawer

查看:246
本文介绍了布局定位问题,自定义SlidingDrawer的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我一直在努力使这项工作相当长一段时间,我都觉得自己,我发现了一个的网络上的组件至极是pretty不错的,它可以让我上下滑动,默认的样品是pretty容易了吧推移顶部和下降:

Hi everyone i've been trying to make this work for quite a while and i feel stuck, i found a component on web wich is pretty nice, it allows me top to bottom sliding, the default sample is pretty easy the bar goes on top and the goes down:

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

    <Button
        android:id="@+id/button_open"
        android:layout_width="100dp"
        android:layout_height="wrap_content"
        android:text="@string/open"
        android:layout_centerInParent="true"
        android:visibility="gone" />

        <TextView android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceMedium" android:layout_width="wrap_content" 
        android:text="@string/default_feed_detail" android:id="@+id/txtDetailNews" ></TextView>

    <it.sephiroth.demo.slider.widget.MultiDirectionSlidingDrawer
        xmlns:my="http://schemas.android.com/apk/res/it.sephiroth.demo.slider"
        android:id="@+id/drawer"
        my:direction="topToBottom"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        my:handle="@+id/handle"
        my:content="@+id/content">
        <include
            android:id="@id/content"
            layout="@layout/pen_content" />

        <ImageView
            android:id="@id/handle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/sliding_drawer_handle_bottom" />
    </it.sephiroth.demo.slider.widget.MultiDirectionSlidingDrawer>
</RelativeLayout>

和它呈现这样的相当不错:

And it renders like this quite nicely:

但现在我想有文字之间,然后自定义slidingdrawer它只是没有呈现文本之间的标题图片

But now i want to have a header image between the text and between then the custom slidingdrawer it just not render the text

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

    <Button android:id="@+id/button_open" android:layout_width="100dp"
        android:layout_height="wrap_content" android:text="@string/open"
        android:layout_centerInParent="true" android:visibility="gone" />

    <ImageView android:id="@+id/header" android:src="@drawable/header"
        android:layout_height="wrap_content" android:layout_width="wrap_content"></ImageView>




    <it.sephiroth.demo.slider.widget.MultiDirectionSlidingDrawer
        xmlns:my="http://schemas.android.com/apk/res/it.sephiroth.demo.slider"
        android:layout_below="@id/header"
        android:id="@+id/drawer" my:direction="topToBottom"
        android:layout_width="fill_parent" android:layout_height="wrap_content"
        my:handle="@+id/handle" my:content="@+id/content">
        <include android:id="@id/content" layout="@layout/pen_content" />

        <ImageView android:id="@id/handle" android:layout_width="wrap_content"
            android:layout_height="wrap_content" android:src="@drawable/sliding_drawer_handle_bottom" />
    </it.sephiroth.demo.slider.widget.MultiDirectionSlidingDrawer>

    <TextView android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:layout_below="@id/drawer"
        android:layout_width="wrap_content" android:text="@string/default_feed_detail"
        android:id="@+id/txtDetailNews"></TextView>


</RelativeLayout>

现在的文字消失了....用相对布局任何建议或如果任何人有一个想法或组件,因此可以做到伊斯利这将是伟大的太感谢了!

and now the text is gone.... any suggestion with Relative Layout, or If anyone has an idea or component so it can be done easly that would be great too thanks!!

修改

我发现了一些与hierarchyviewer有趣的使用下面的布局来安排组件:

I found something interesting with the hierarchyviewer using the following layout to arrange the components:

<it.sephiroth.demo.slider.widget.MultiDirectionSlidingDrawer
    xmlns:my="http://schemas.android.com/apk/res/it.sephiroth.demo.slider"
    android:layout_above="@id/txtDetailNews"
    android:id="@+id/drawer" my:direction="topToBottom"
    android:layout_width="fill_parent" android:layout_height="wrap_content"
    my:handle="@+id/handle" my:content="@+id/content">
    <include android:id="@id/content" layout="@layout/pen_content" />

    <ImageView android:id="@id/handle" android:layout_width="wrap_content"
        android:layout_height="wrap_content" android:src="@drawable/sliding_drawer_handle_bottom" />
</it.sephiroth.demo.slider.widget.MultiDirectionSlidingDrawer>

似乎是在抽屉内的部件正在呈现,并采取所有的空间,如下所示:

it seems that the components that are inside the Drawer are being render and take all the space as shown here:

推荐答案

嗯,我不得不做一些变通方法与此,因为在后台的内容采取了空间,而TextView的是放弃它的空间我的所作所为是以下内容:

Well i had to do a little workaround with this since the content on the background took the space, and the Textview was giving up its space what i did was the following:

我把TextView的一个100dip的paddingTop头的ImageView后。

I place the TextView after the header imageView with a paddingTop of a 100dip.

    android:layout_width="wrap_content" android:text="@string/default_feed_detail"
    android:id="@+id/txtDetailNews" android:layout_alignWithParentIfMissing="@id/header" ></TextView>

然后在MultiDirectionalSlidingDrawer我设置了 Android的内容:layout_above =@ ID / txtDetailNews

这pretty多解决呈现的内容和头之间的滑动问题,谢谢大家帮助我......特别弥敦道图你赚的50岁男性(Y)

And that pretty much solve the problem rendered the sliding between the Content and the header, Thank you all for helping me out... Specially Nathan Fig you earn those 50 man (y)

这篇关于布局定位问题,自定义SlidingDrawer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆