본문 바로가기

개발도구/aOS - 안드로이드 개발

[안드로이드] 슬라이드 에니메이션, 밑 고정 메뉴

위의 사진과 같이 손가락으로 클릭후 끌어 메뉴를 갖고 올수 가 있습니다. 
아래 있는 고정 메뉴는 쉽게 HTML로 말하자면 include 같이 main 에 UI을 고정해놓는거예요.
손으로 집어 끌어 올리는 SlidingDrawer 와 Drawer 클래스에 관해 알아 보도록 하죠..
간단히 소스를 공개합니다.


main.xml

<패키지명.Drawer

    android:id = "@+id/customDrawer"

    android:layout_width="wrap_content" 

    android:layout_height="wrap_content"

    android:layout_gravity="bottom" 

    />


main.class
draw = (Drawer)findViewById(R.id.customDrawer);


Drawer.class
public class Drawer extends FrameLayout{
private ImageButton ImageButton1;
private ImageButton ImageButton2;
private ImageButton ImageButton3;
private ImageButton ImageButton4;
private ImageButton ImageButton5;

LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
inflater.inflate(R.layout.drawer, this, true);
 
 slide = (SlidingDrawer)findViewById(R.id.drawer);
.
. 생략

slide.animateOpen();
slide.animateClose();
 

drawer.xml
<SlidingDrawer
    android:id="@+id/drawer"
    android:layout_width="fill_parent"
    android:layout_height="240dip"
    android:handle="@+id/handle"
    android:content="@+id/content"
    android:bottomOffset="40dip"
   > 
    <ImageView
        android:id="@id/handle"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/btn_up"
   /> 
<LinearLayout android:layout_width="fill_parent"
            android:layout_height="wrap_content" 
            android:id="@id/content"
            android:orientation="vertical" 
          
            > 
            <LinearLayout android:layout_width="fill_parent"
            android:layout_height="wrap_content" 
            android:orientation="horizontal" 
            >
버튼1 
<ImageButton android:scaleType="center"  android:layout_height="wrap_content" 
android:layout_width="wrap_content" android:background="@drawable/navi_news_off"
android:id="@+id/ImgButton1" ></ImageButton> 
    버튼2
버튼3
버튼4 
</LinearLayout>  
                 <LinearLayout android:layout_width="fill_parent"  ... 
                 이렇게 만들고 싶은 단을 계속 붙여 넣기 한다.