zoukankan      html  css  js  c++  java
  • Android之SlidingDrawer使用

    slidingDrawer有垂直与水平的两种模式。最重要的还是在布局方面 : 在SlidingDrawer中handle与content的属性必须设置。

     <?xml version="1.0" encoding="utf-8"?>  
     <RelativeLayout  

      xmlns:android="http://schemas.android.com/apk/res/android"  

      android:layout_width="fill_parent"  

      android:layout_height="fill_parent">
      <TextView
        
    android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/hello"
        android:textSize="16sp"
      
    />
      <SlidingDrawer 
        
    android:id="@+id/drawer1" 
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent" 
        android:handle="@+id/layout1"  //设置slidingdrawer拖动的图标
        android:content="@+id/myContent1"  //设置slidingdrawer的内容
        android:orientation="horizontal" //设置slidingdrawer为水平模式
      
    >
        <LinearLayout 
          
    android:id="@id/layout1" 
          android:layout_width="35px"  //由于slidingdrawer是水平模式,所以这里设置的width是从右边起
          android:layout_height="fill_parent" //同理如果slidingdrawer是垂直模式,设置的height是从下面起
          android:background="@drawable/black"
          android:gravity="center" 
        
    >
          <ImageView
            
    android:id="@+id/myImage1" 
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content" 
            android:src="@drawable/open"
          
    />
        </LinearLayout>
        <GridView 
          
    android:id="@id/myContent1" 
          android:layout_width="wrap_content" 
          android:layout_height="wrap_content" 
          android:numColumns="2"
          android:background="@drawable/black" 
          android:gravity="center"
        
    />       
      </SlidingDrawer>

    </RelativeLayout>  


  • 相关阅读:
    初窥AndroidPlot(一)
    Android Studio安装、配置
    Android SDK Android NDK Android Studio 官方下载地址及方式
    学习Android图表绘制
    ActionBar研究(二)
    获取Android版本信息和程序版本号
    Android手机获取通话记录和短信记录
    Android开发之监听或获取手机短信内容【转】
    android 几种发送短信的方法【转】
    android开源框架android-async-http
  • 原文地址:https://www.cnblogs.com/lee0oo0/p/2674798.html
Copyright © 2011-2022 走看看