2016-07-08 1 views
0

アンドロイドスタジオのアクションバーにテキストを書き込むにはどうすればよいですか?私はwhatsappのような私のアクションバーに2つのテキストをテキストで書きたい。私はそれが与えられたコードを参照してくださいが、それを行う方法を私に示していません。Androidスタジオアクションバーのテキスト

アクションバー:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="match_parent"> 

    <android.support.v4.view.ViewPager 
     android:id="@+id/pager" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" /> 

<LinearLayout 
    android:id="@+id/header" 
    android:layout_width="match_parent" 
    android:layout_height="59dp" 
    android:background="?attr/colorPrimaryDark" 
    android:orientation="vertical"> 

</LinearLayout> 

</FrameLayout> 
+0

使用ツールバーlike--見なければなりませんアクションバーの代わりにレイアウト。 –

+0

どうすれば使用できますか? –

答えて

0

リファレンスsee google docs

<android.support.v7.widget.Toolbar 
xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
android:layout_width="match_parent" 
android:layout_height="wrap_content" 
/> 

include-- Theme.AppCompat.NoActionBar ...あなたのレイアウトでは

使用テーマは、あなたの活動は、カスタムと

public class MyActivity extends AppCompatActivity { 
@Override 
protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.activity_my); 
    Toolbar myToolbar = (Toolbar) findViewById(R.id.my_toolbar); 
    setSupportActionBar(myToolbar); 
    } 
} 
+0

ありがとうございますが、私はすでに問題を解決しました –

+0

@ ban23 good ..それでも正解とマークすることはできます。 –