2

我有 SlidingPaneLayout 的问题。当我打开菜单(使用 spl 制作)时,所有视图(文本视图、图像视图等)在屏幕截图上看起来都像这些文本视图(它们在文本周围有奇怪的颜色,25 号可以 - 这个可见时是绿色的):

在此处输入图像描述

如何解决这个问题?

4

2 回答 2

2

您只需将以下行添加到您的代码中:

mSlidingPane.setSliderFadeColor(getResources().getColor(android.R.color.transparent));

有关更多信息,请参阅文档

于 2014-08-25T13:57:10.437 回答
0

除了“reVerse”答案:

  1. 设置您的自定义颜色:

    mSlidingPane.setSliderFadeColor(getResources().getColor(R.color.mycolor));

  2. 重要提示:确保您的幻灯片版式具有背景颜色(任何颜色都可以)。

这有效:

<android.support.v4.widget.SlidingPaneLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/tools"
android:id="@+id/SlidingPanel"
android:layout_width="match_parent"
android:layout_height="match_parent">

<LinearLayout
    android:layout_width="240dp"
    android:layout_height="match_parent"
    android:layout_gravity="left">

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:paddingRight="10dp"
            android:id = "@+id/drawerContainer"
            android:orientation="vertical">
        </LinearLayout>
    </ScrollView>
</LinearLayout>

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_gravity="right"
    android:layout_height="match_parent"
    android:background="@color/grey_light">
    <!--- your content here -->
</RelativeLayout>
</android.support.v4.widget.SlidingPaneLayout>

要模仿一般的灰色背景,您可以使用:

<color name="grey_light">#fffafafa</color>
于 2016-10-11T11:50:44.427 回答