2016-05-21 3 views
0

この状況が発生します。どのようにアイコンを高い位置に置くか?ここに私のJavaコードツールバーのActionBarDrawerToggleの位置を変更します

DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); 
    ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
      this, drawer, (Toolbar) findViewById(R.id.nullToolbar), R.string.nav_drawer_open, R.string.nav_drawer_close); 
    drawer.addDrawerListener(toggle); 
    toggle.syncState(); 

ツールバーの私のXMLである

enter image description here

切断されているようです。

<android.support.v7.widget.Toolbar 
       android:id="@+id/nullToolbar" 
       android:layout_width="match_parent" 
       android:layout_height="34dp" 
       android:background="?attr/colorPrimary" 
       app:contentInsetEnd="0dp" 
       app:contentInsetStart="0dp" 
       app:popupTheme="@style/AppTheme.PopupOverlay" 
       app:titleTextAppearance="@style/ToolbarTitle"> 
       <RelativeLayout 
        android:layout_width="match_parent" 
        android:layout_height="match_parent"> 
        <ImageButton 
         android:id="@+id/btnToolbarSearch" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:layout_alignParentRight="true" 
         android:background="?attr/selectableItemBackground" 
         android:padding="@dimen/image_button_padding" 
         android:src="@drawable/ic_search_white" /> 
       </RelativeLayout> 

    </android.support.v7.widget.Toolbar> 

答えて

0

あなたは

<android.support.v7.widget.Toolbar 
      android:id="@+id/nullToolbar" 
      android:layout_width="match_parent" 
      android:layout_height="?attr/actionBarSize" 
      ... 
+0

を持つべきか、私はあなたがアンドロイドを使用することができると思う:私はそれを行う場合、私は自分のデザインを破るよlayout_height =「wrap_content」 –

+0

を。私のAppBarLayOutに複数のツールバーが含まれています –

+0

ああ。たぶんあなたはあなたの質問にXMLレイアウト全体を入れておくべきでしょう。 –

関連する問題