2011-11-18 3 views
3

버튼을 클릭하면 화면의 상단에있는 하나의 버튼을 포함하는 레이아웃을 디자인하고 싶습니다. 버튼을 클릭하면 하단에서 오는 레이아웃을 열어야합니다 키패드처럼.대화 상자와 같은 레이아웃이 안드로이드의 아래쪽에서옵니다.

하지만 어떻게 해야할지 모르겠습니까?

의견을 보내주십시오. 레이아웃의

스크린 샷 :

enter image description here

내가 그 드롭 다운 버튼을 클릭

가 다른 레이아웃이 가상 키패드의 크기와 다운로드에서 올 것이다.

감사합니다, Ammu

답변

2

애니메이션이 작업을 수행하는 데 도움이 될 수 있습니다 :

private void initPopup() 
{ 

    final TransparentPanel popup = (TransparentPanel) findViewById(R.id.popup_window); 

    // Start out with the popup initially hidden. 
    popup.setVisibility(View.GONE); 


    animShow = AnimationUtils.loadAnimation(this, R.anim.popup_show); 
    animHide = AnimationUtils.loadAnimation(this, R.anim.popup_hide); 

    final Button showButton = (Button) findViewById(R.id.show_popup_button); 
    final Button hideButton = (Button) findViewById(R.id.hide_popup_button); 
    showButton.setOnClickListener(new View.OnClickListener() { 
     public void onClick(View view) { 
      popup.setVisibility(View.VISIBLE); 
      popup.startAnimation(animShow); 
      showButton.setEnabled(false); 
      hideButton.setEnabled(true); 
    }}); 

    hideButton.setOnClickListener(new View.OnClickListener() { 
     public void onClick(View view) { 
      popup.startAnimation(animHide); 
      showButton.setEnabled(true); 
      hideButton.setEnabled(false); 
      popup.setVisibility(View.GONE); 
    }}); 


    final TextView locationName = (TextView) findViewById(R.id.location_name); 
    final TextView locationDescription = (TextView) findViewById(R.id.location_description); 

    locationName.setText("Animated Popup"); 
    locationDescription.setText("Animated popup is created by Arun nu solla mattaen" 
           + " Transparent layout is used on this example, and animation xml is also used" 
           + " on this example. Have a Good day guys."); 
} 

이 당신을하는 데 도움이 example

희망을 참조하십시오.

+0

입니다으로 SlidingDrawer을 시도 이봐, 난 이미 바닥에서 오는 레이아웃이 전체 레이아웃을 차지하는 것 ... 그 코드를 사용하여보고했다. 난 그냥 작은 높이 싶어요. – Taruni

관련 문제