2016-08-16 26 views
0
actionBar = getSupportActionBar(); 
ActionBar.LayoutParams params = new ActionBar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); 
View view = LayoutInflater.from(this).inflate(R.layout.head, null); 
actionBar.setCustomView(view, params); 

like this,なぜsetCustomViewは常に左と右に少しのスペースを残しますか?

私はseached多くの方法を試してみましたが、マージンを削除するには、このを試してみてください。..

答えて

0

を失敗しました:

ActionBar actionBar = getSupportActionBar(); 
actionBar.setDisplayShowHomeEnabled(false); 
actionBar.setDisplayShowCustomEnabled(true); 
actionBar.setDisplayShowTitleEnabled(false); 
View customView = getLayoutInflater().inflate(R.layout.main_action_bar, null); 
actionBar.setCustomView(customView); 
Toolbar parent =(Toolbar) customView.getParent(); 
parent.setContentInsetsAbsolute(0,0); 
+0

申し訳ありませんが、私はASは、その[言うtried.but parent]がnullの場合..... – hehuan

関連する問題