Guest User

Untitled

a guest
Nov 22nd, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. ActionBar actionBar = ((AppCompatActivity)getActivity()).getSupportActionBar();
  2.  
  3. if (actionBar == null) {
  4.  
  5. return;
  6.  
  7. }
  8.  
  9. actionBar.setDisplayShowHomeEnabled(false);
  10. actionBar.setDisplayShowCustomEnabled(true);
  11. actionBar.setDisplayShowTitleEnabled(false);
  12. actionBar.setCustomView(R.layout.actionbar_navigation_menu);
  13. ((TextView)actionBar.getCustomView().findViewById(R.id.action_bar_title)).setText(R.string.notebook_list_fragment_title);
  14. (actionBar.getCustomView().findViewById(R.id.upButtonRipple)).setOnClickListener(new View.OnClickListener() {
  15.  
  16. @Override
  17. public void onClick(View v) {
  18.  
  19. //クリック時の処理
  20.  
  21. }
  22.  
  23. });
  24.  
  25. //デフォルトの設定を上書き
  26. Toolbar parent =(Toolbar)actionBar.getCustomView().getParent();
  27. parent.setContentInsetsAbsolute(0,0);
  28.  
  29. Toolbar parent =(Toolbar)actionBar.getCustomView().getParent();
  30. parent.setContentInsetsAbsolute(0,0);
Add Comment
Please, Sign In to add comment