android课程_Android SlidingPaneLayout:教学课程

android课程

在这篇文章中,我们想展示如何使用SlidingPaneLayout 。 这是一个有趣的组件,可以在我们想要多窗格水平布局时使用。 此组件分为两个不同的部分:

  • 左侧:主要部分。 它通常包含值列表(例如,Contacts等)
  • 右侧:细节部分。 它在左侧包含值的详细信息。

此组件可帮助我们将可用的屏幕空间划分为两个不重叠且可以水平滑动的不同侧面。 知道何时该启用滑动功能或何时该屏幕宽度足以容纳两个部件,这一点足够聪明。

在本文中,我们将展示如何使用该组件在一侧实现书签列表,并在另一侧实现相应的Web内容视图。 SlidingPaneLayout可以与片段或其他标准组件一起使用,我们将展示如何与片段一起使用。 我们必须记住的一件事是,在我们的主要布局中,它必须是根源。 最后,我们希望具有如下所示的图片:

android_slidingpanelayout_page_loaded_thumb [5]

开始吧。

设置SlidingPaneLayout

我们需要做的第一件事是创建主布局:

<android.support.v4.widget.SlidingPaneLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/sp" >
    <!-- Left side pane. (Master) -->
    <fragment android:id="@+id/leftpane"
              android:name="com.survivingwithandroid.slidingpanelayout.ListBookmarkFragment"
              android:layout_width="190dp"
              android:layout_height="match_parent"
              android:layout_gravity="left"  />

    <!-- Right side page. (Slave)  -->
    <fragment android:id="@+id/rightpane"
              android:name="com.survivingwithandroid.slidingpanela
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
下面是Android Studio失物招领模块Xml文件的实现代码,请修改代码实现下拉以及图片上传功 <TextView android:id="@+id/shiwuzhaolingzi" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="请选择是失物还是招领" /> <Spinner android:id="@+id/spinner_lost_found" android:layout_width="match_parent" android:layout_height="wrap_content" android:entries="@array/lost_found_array" /> <TextView android:id="@+id/text_item_name" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="物品名称" /> <EditText android:id="@+id/edit_item_name" android:layout_width="match_parent" android:layout_height="wrap_content" android:inputType="text" /> <TextView android:id="@+id/text_item_desc" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="物品描述" /> <EditText android:id="@+id/edit_item_desc" android:layout_width="match_parent" android:layout_height="wrap_content" android:inputType="text" /> <TextView android:id="@+id/text_item_time" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="时间" /> <EditText android:id="@+id/edit_item_time" android:layout_width="match_parent" android:layout_height="wrap_content" android:inputType="text" /> <TextView android:id="@+id/text_item_location" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="地点" /> <EditText android:id="@+id/edit_item_location" android:layout_width="match_parent" android:layout_height="wrap_content" android:inputType="text" /> <Button android:id="@+id/button_upload_image" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="上传图片" /> <TextView android:id="@+id/text_image_path" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="图片路径:" /> <Button android:id="@+id/button_submit" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="提交" /> </LinearLayout>
05-17

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值