문제

사용자 정의보기에서 탐색 서랍 아이콘이

에 의해 사라 졌는 이유
actionbar.setCustomView(R.layout.blah);
.

어떻게 해결할 수 있습니까?

도움이 되었습니까?

해결책

확인, 코드를 게시하지 않으므로 여기에 물건을 가정해야합니다.따라서 귀하의 질문을 업데이트하고 실제 코드를 표시 할 수 있다면!

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    ActionBar actionBar = getActionBar();

    // Depending on what your custom Action Bar will do, you might want to disable these!
    actionBar.setDisplayShowHomeEnabled(false);
    actionBar.setDisplayShowTitleEnabled(false);

    LayoutInflater inflater = LayoutInflater.from(this);

    View customView = inflater.inflate(R.layout.custom_actionbar, null);

    // Here is how you can get specific items from your custom view!
    TextView titleTextView = (TextView) customView.findViewById(R.id.title_text);
    titleTextView.setText("My Own Title");

    ...

    // MAKE SURE THESE ARE SET!! BOTH OF THEM!!
    actionBar.setCustomView(mCustomView);
    actionBar.setDisplayShowCustomEnabled(true);
}
.

가장 큰 문제는 아마도 맨 끝에 코드 일 것입니다.그 코드가 있는지 확인하십시오!

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top