- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
你好我是 android 的初学者,在我的应用程序中我必须在右侧显示 SlidingPaneLayout 但使用我下面的代码它来自左侧。
请帮帮我。
如何让它在右侧?
第二,我的要求是我的 SlidingPaneLayout 必须重叠在操作栏上,但使用我下面的 xml 代码 SlidingPaneLayout 显示如下图
请建议我如何解决这两个问题
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/ColorPrimary"
android:elevation="4dp"
>
</android.support.v7.widget.Toolbar>
<android.support.v4.widget.SlidingPaneLayout xmlns:android="http://schemas.android.com/apk/res/android"
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="right">
<ListView
android:id="@+id/MenuList"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</ListView>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="right"
android:background="#101010"
android:orientation="vertical" >
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/android_robot" />
</LinearLayout>
</android.support.v4.widget.SlidingPaneLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include
android:id="@+id/tool_bar"
layout="@layout/toolbar_layout">
</include>
<include
android:id="@+id/SlidingPanel"
layout="@layout/activity_sliding">
</include>
</LinearLayout>
最佳答案
在您的 list 中,将以下属性添加到开头 <application>
标签。
android:supportsRtl="true"
然后把这个属性加到开头SlidingPaneLayout
在布局中标记。
android:layoutDirection="rtl"
最后,移动 tool_bar
<include>
元素进入主要内容LinearLayout
在 SlidingPaneLayout
内, 并调整 ImageView
的高度和体重。
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#101010"
android:orientation="vertical">
<include
android:id="@+id/tool_bar"
layout="@layout/toolbar_layout">
</include>
<ImageView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="@drawable/android_robot" />
</LinearLayout>
请注意 child View
SlidingPaneLayout
的小号将继承 rtl
layoutDirection
.这可能会导致 child 出现问题 View
s 如果它们的布局行为受方向影响。例如,水平方向的 LinearLayout
将从右边开始布置它的 child 。这很容易通过设置 android:layoutDirection="ltr"
来解决。在受影响的View
另请注意,此示例对布局中的方向进行了硬编码。如果您需要在整个应用程序范围内同时支持 LTR 和 RTL 布局,您需要以编程方式执行此操作,并考虑到设备的默认方向。
关于android - 如何在右侧显示 SlidingPaneLayout?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36660629/
我在我的应用程序中使用 NavigationDrawer 作为主菜单。我的一些 fragment 使用了 SlidingPaneLayout。 目前,我在右边显示 NavigationDrawer,在
我想要的是用户第一次打开我的应用程序时,左侧面板可以使用全屏!然后我需要调整它的大小。 最佳答案 阅读 SlidingPaneLayout 源代码后:SlidingPaneLayout.java ,您
我正在尝试使用 SlidingPaneLayout 制作原型(prototype)应用。我的 SlidingPaneLayout 是灰色的,正文 View 是纯白色的。但是当我滑入时,正文页面的小可见
我正在使用 SlidingUpPanel .一切都很好。 :) 我想要实现的是将图像中面板的背景颜色更改为透明,以便显示它后面的图像部分。我尝试将 SLidingPaneLayout 的背景颜色设置为
我正在尝试使用 SlidingPaneLayout。左 View 是 ListFragment,右 View 是详细 View 。布局显示正确,我可以滑动它。但是如果详细 View 在列表前面并且我点
是否有可能以某种方式使用 Android 的 SlidingPaneLayout 来做它所做的,除了从相反的一侧? 即我想滑动屏幕的右侧而不是左侧以显示第二个 Pane ,它从右侧而不是左侧滑入。 理
你好我是 android 的初学者,在我的应用程序中我必须在右侧显示 SlidingPaneLayout 但使用我下面的代码它来自左侧。 请帮帮我。 如何让它在右侧? 第二,我的要求是我的 Slidi
我有一个带有 SlidingPaneLayout 的 Activity,里面有两个 fragment :一个 ListView 在左边,一个 MapFragment 在左边正确的。如何拦截产生的触摸事
我想使用 SlidingPaneLayout.getState();但没有找到。是否被删除以及何时删除? public void showAudioPlayer() { mActivi
是否可以将SlidingPaneLayout的触摸事件限制在屏幕链接的最左边缘发生在DrawerLayout中? 最佳答案 是的,但是您想创建自己的 SlidingPaneLayout 实现并重写 o
我正在尝试创建一个在滑动 Pane 中具有 MapFragment 的应用程序。 map 位于一个 fragment 上,该 fragment 滑开进入主要内容,一个 ListView。但是,我无法完
我正在开发一个带有滑动 Pane 的应用程序并且工作正常,但我不知道如何像 Hangouts Google 应用程序一样放置阴影。 有点难解释,看这个: 我正在尝试使用 setShadowResour
有没有办法让 SlidingPaneLayout 从下往上滑动,而不是从右往左滑动。 最佳答案 试试这个库: https://github.com/umano/AndroidSlidingUpPane
我在我的应用程序中使用了 SlidingPaneLayout,但我遇到了一个问题,因为当我打开滑动 Pane 时,整个被覆盖的 Pane 不会淡出,而只有其中的一些元素会淡出,例如 TextView、
我有一个包含 ListView 的滑动 Pane 布局。我有一个按钮可以打开滑动 Pane 。因此,我想禁用此滑动 Pane 的滑动手势,这在我尝试访问同一布局中的任何其他 View 时会产生问题。
我在我的 SlidingPaneLayout 中使用 ListView 作为辅助 View 。主视图是一个 map fragment 。 ListView 充当菜单。问题是 onItemClicked
我需要禁用滑动来打开/关闭 SlidingPaneLayout,因为我的主视图是 map 。我将使用按钮打开/关闭它。 最佳答案 子类 SlidingPaneLayout,覆盖 onIntercept
我在 Activity 中使用 SlidingPaneLayout: ... ... 我希望菜单覆盖页面的 3/4 我希望它可以在所有手机上使用,所以我不能放例如 android:la
我正在使用 android.support.v4.widget.SlidingPaneLayout 制作滑动菜单。唉,SlidingPaneLayout 只推送主要内容,不包括操作栏。我也希望这个布局
我对 SlidingPaneLayout 有疑问。当我打开菜单(用 spl 制作)时,所有 View ( TextView 、 ImageView 等)在屏幕截图上看起来像这些 TextView (它
我是一名优秀的程序员,十分优秀!