如何在umano滑动面板中更改可见区域的高度?

时间:2016-12-08 21:30:44

标签: android slidingpanelayout

我想更改默认情况下可见的面板高度。

我尝试改变umanoPanelHeight,但它绝对没有效果。

<com.sothree.slidinguppanel.SlidingUpPanelLayout xmlns:sothree="http://schemas.android.com/apk/lib/com.my.app"
                android:id="@+id/sliding_layout"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:gravity="bottom"
                sothree:umanoDragView="@+id/dragView"
                sothree:umanoOverlay="true"
                sothree:umanoPanelHeight="68dp"
                sothree:umanoParalaxOffset="100dp"
                sothree:umanoShadowHeight="4dp">

    <FrameLayout
                android:id="@+id/container"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
    // Details omitted  
    />

    <LinearLayout
                android:id="@+id/container2"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
    // Details omitted  
    />
</com.sothree.slidinguppanel.SlidingUpPanelLayout>

我之前也遇到过这个问题,但当时无法解决。它看起来很基本但我无法弄清楚。有人能帮我吗。谢谢!!

1 个答案:

答案 0 :(得分:2)

我创建了一个基本集成的示例,它完美无缺。我希望你能发现你做的与众不同的事情可以帮助你。

我还会将内部布局更改为简单的文本视图,以查看问题是否存在。

<强>集成

allprojects {
    repositories {
        //...
        mavenCentral()
    }
}


compile 'com.sothree.slidinguppanel:library:3.3.1'

应用清单

<application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

<强>风格

 <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>

<强> MainActivity

public class MainActivity extends AppCompatActivity {
}

布局

<?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:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin">

    <com.sothree.slidinguppanel.SlidingUpPanelLayout
        xmlns:sothree="http://schemas.android.com/apk/res-auto"
        android:id="@+id/sliding_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="bottom"
        sothree:umanoPanelHeight="368dp"
        sothree:umanoShadowHeight="4dp">

        <TextView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="center"
            android:text="Main Content"
            android:textSize="16sp" />

        <TextView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="center|top"
            android:text="The Awesome Sliding Up Panel"
            android:textSize="16sp" />
    </com.sothree.slidinguppanel.SlidingUpPanelLayout>

</RelativeLayout>

<强>布局1

<?xml version="1.0" encoding="utf-8"?>
    <com.sothree.slidinguppanel.SlidingUpPanelLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        xmlns:sothree="http://schemas.android.com/apk/res-auto"
        android:id="@+id/sliding_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="bottom"
        sothree:umanoPanelHeight="368dp"
        sothree:umanoShadowHeight="4dp">

        <TextView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="center"
            android:text="Main Content"
            android:textSize="16sp" />

        <TextView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="center|top"
            android:text="The Awesome Sliding Up Panel"
            android:textSize="16sp" />
    </com.sothree.slidinguppanel.SlidingUpPanelLayout>

布局和布局1都工作正常,我可以看到面板增加的大小,因为我使用了368dp而不是默认值68dp。在Android 6.0上测试。