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



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

我尝试更改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>

我也早些时候遇到了这个问题,但无法解决。它看起来很基本,但我不知道。有人能帮我吗。谢谢!

我创建了一个具有基本集成的示例,并且完美效果。希望它能帮助您,您可以发现自己在做的事情不同。

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

集成

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>

layout1

<?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上测试。

最新更新