결과화면

//SlidingDemo.java

 

 package com.example.widgetdemo1;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.widget.SlidingDrawer;
import android.widget.Toast;

public class SlidingDemo extends Activity {
 private SlidingDrawer drawer;
 private static final String TAG = "SlidingDemo";

 @Override
 public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.sliding1);
  drawer = (SlidingDrawer)findViewById(R.id.slidingdrawer);
  
  drawer.setOnDrawerCloseListener(new SlidingDrawer.OnDrawerCloseListener() {
   
   @Override
   public void onDrawerClosed() {
    Log.i(TAG, "DrawerClose");
    Toast.makeText(SlidingDemo.this, "DrawerClose", Toast.LENGTH_SHORT).show();
   }
  });
  
  drawer.setOnDrawerOpenListener(new SlidingDrawer.OnDrawerOpenListener() {
   
   @Override
   public void onDrawerOpened() {
    Log.i(TAG, "DrawerOpen");
    Toast.makeText(SlidingDemo.this, "DrawerOpen", Toast.LENGTH_SHORT).show();
   }
  });
  
  drawer.setOnDrawerScrollListener(new SlidingDrawer.OnDrawerScrollListener() {
   
   @Override
   public void onScrollStarted() {
    Log.i(TAG, "onScrollStarted");
    Toast.makeText(SlidingDemo.this, "onScrollStarted", Toast.LENGTH_SHORT).show();
   }
   
   @Override
   public void onScrollEnded() {
    Log.i(TAG, "onScrollEnded");
    Toast.makeText(SlidingDemo.this, "onScrollEnded", Toast.LENGTH_SHORT).show();
   }
  });
 }
}

 

 //sliding1.xml

 

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent">
 <SlidingDrawer
     android:id="@+id/slidingdrawer"
     android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:content="@+id/content"
  android:handle="@+id/handle"
  android:orientation="vertical" > 
 <Button android:id="@+id/handle"        
   android:layout_width="wrap_content"
   android:layout_height="50dp"
   android:text="위로"/>
  <LinearLayout
  android:orientation="vertical"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:background="#000000"
  android:id="@+id/content"
  >
  <TextView
   android:layout_width="fill_parent"
   android:layout_height="fill_parent"
   android:textStyle="bold"
   android:background="#FFFFFF00"
   android:text="이것은 슬라이딩드로어 입니다."
  />
  </LinearLayout>
  </SlidingDrawer>
</LinearLayout>

 

'2020년도 이전 > [WebSig] Android' 카테고리의 다른 글

style(스타일) 적용 및 theme(테마) 적용  (0) 2013.08.16
이클립스에서 logcat이 안보인다면?  (0) 2013.08.16
Flipper Demo - 뷰플리퍼  (0) 2013.08.16
GridView Demo  (0) 2013.08.14
ExpandableList ViewDemo  (0) 2013.08.14

+ Recent posts