2014-12-19 5 views
-1

현재 내 앱에는 오른쪽 상단에있는이 아이콘을 사용하는 Settings 옵션이 포함 된 드롭 다운 메뉴가 있습니다. enter image description here이 아이콘 enter image description here으로 바꾸고 싶습니다. 아래로 탭에서 새보기 호출. 안드로이드 드롭 다운 메뉴에서 설정 버튼

내가 현재

@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(); 

    Intent intent = new Intent(this, appSets.class); 
    startActivity(intent); 
    overridePendingTransition(R.anim.abc_fade_in, R.anim.abc_fade_out); 
    //noinspection SimplifiableIfStatement 
    if (id == R.id.action_settings) { 

     return true; 
    } 

    return super.onOptionsItemSelected(item); 
} 

답변

0

당신은 당신의 res/menu/filename.xml

<menu xmlns:android="http://schemas.android.com/apk/res/android" 
     xmlns:tools="http://schemas.android.com/tools" > 
     <item 
     android:id="@+id/action_settings" 
     android:showAsAction="always" 
     andoid:title="@string/action_settings" 
     android:icon="@drawable/ic_action_settings"/> 
</menu> 

android:showAsAction="always"을 설정 한 설정 메뉴를 처리하는 방법이며 appcompatv7 라이브러리를 사용하는 경우 당신은 그것을 조금 수정해야

<menu xmlns:android="http://schemas.android.com/apk/res/android" 
     xmlns:tools="http://schemas.android.com/tools" 
     xmlns:app="http://schemas.android.com/apk/res-auto" > 
     <item 
     android:id="@+id/action_settings" 
     app:showAsAction="always" 
     andoid:title="@string/action_settings" 
     android:icon="@drawable/ic_action_settings"/> 
</menu> 
0

res/menu/main.xml 및 항목 012로 이동하십시오.대신 android:icon="@drawable/new_pic" 드로어 블 이미지 사용

관련 문제