我有 SlidingPaneLayout 的问题。当我打开菜单(使用 spl 制作)时,所有视图(文本视图、图像视图等)在屏幕截图上看起来都像这些文本视图(它们在文本周围有奇怪的颜色,25 号可以 - 这个可见时是绿色的):
如何解决这个问题?
我有 SlidingPaneLayout 的问题。当我打开菜单(使用 spl 制作)时,所有视图(文本视图、图像视图等)在屏幕截图上看起来都像这些文本视图(它们在文本周围有奇怪的颜色,25 号可以 - 这个可见时是绿色的):
如何解决这个问题?
您只需将以下行添加到您的代码中:
mSlidingPane.setSliderFadeColor(getResources().getColor(android.R.color.transparent));
有关更多信息,请参阅文档
除了“reVerse”答案:
设置您的自定义颜色:
mSlidingPane.setSliderFadeColor(getResources().getColor(R.color.mycolor));
重要提示:确保您的幻灯片版式具有背景颜色(任何颜色都可以)。
这有效:
<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>