2014-10-09 5 views
0

현재 작업중인 앱의 디자인에는 작업 표시 줄의 메뉴 버튼을위한 공간이 없습니다. 일부 안드로이드 장치에는 메뉴 하드웨어 단추가 없으며 화면 단추에 추가 단추가있는 응용 프로그램을 보았습니다. 응용 프로그램에서이를 구현하고 싶습니다.화면 버튼에 추가 버튼 추가

나는 화면 버튼이 버튼을 추가하는 방법을 알고 싶어

http://i.stack.imgur.com/D4yjk.png

답변

0

이 버튼은 물리적 인 메뉴 버튼이없는 기기에 하드웨어 메뉴 버튼을 대체합니다. 그러나 앱이 여전히 이전 메뉴 버튼을 사용해야 할 때만 사용됩니다. 이전 메뉴 버튼이 사용되지 않으므로 작업 표시 줄을 정리하고 새로운 디자인 규칙을 구현하는 것이 좋습니다.

주제에 익숙해 지려면 this을 읽어야합니다.

+0

이 보인다 추가 menu 이름 res 폴더에 추가하고이 폴더에 main.xml 복사

<menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" tools:context="com.example.asd.MainActivity" > <!--Change this to your Activity--!> <item android:id="@+id/action_settings" android:orderInCategory="100" android:title="@string/action_settings" app:showAsAction="never"/> </menu> 

를 붙여 추가 액션 바, 여기 메뉴 버튼에 관한 기사도 있습니다 : http://android-developers.blogspot.com/2012/01/say-goodbye-to-menu-button.html –

+0

맞습니다. 기사가 올바르게 지적했듯이 그것은 유산입니다. 어쩌면 stackOverflow에서 디자인 개선 방법을 물어봐야할까요? –

0

새 프로젝트를 생성하면이 작업을 수행해야합니다. 그런 다음 활동에 다시 디자인보다 다른 방법이없는 것처럼이

@Override 
    public boolean onCreateOptionsMenu(Menu menu) { 
     // Inflate the menu; this adds items to the action bar if it is present. 
     getMenuInflater().inflate(R.menu.main, menu); 
     return true; 
    } 

    @Override 
    public boolean onOptionsItemSelected(MenuItem item) { 
     // Handle action bar item clicks here. The action bar will 
     // automatically handle clicks on the Home/Up button, so long 
     // as you specify a parent activity in AndroidManifest.xml. 
     int id = item.getItemId(); 
     if (id == R.id.action_settings) { 
      return true; 
     } 
     return super.onOptionsItemSelected(item); 
    } 

enter image description here