2016-07-14 5 views
2

私はマルチスクリーンをサポートするアプリケーションを開発中です。私はデバイスサイズごとにすべてのレイアウトを完了しましたが、同じためにActionbar/Toolbarのサイズを増やすことはできません。その10inchのタブレットで小さく見える。ツールバーのテキストのサイズを大きくするにはどうすればよいですか?テキストのサイズとスタイルツールバーのAndroid

マイスタイルXMLが

<resources> 

<!-- 
    Base application theme, dependent on API level. This theme is replaced 
    by AppBaseTheme from res/values-vXX/styles.xml on newer devices. 
--> 
<style name="AppBaseTheme" parent="android:Theme.Light"> 

</style> 


<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> 
    <!-- Customize your theme here. --> 
    <item name="colorPrimary">@color/colorPrimary</item> 
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item> 
    <item name="colorAccent">@color/colorAccent</item> 
</style> 

<style name="AppTheme.NoActionBar"> 
    <item name="windowActionBar">false</item> 
    <item name="windowNoTitle">true</item> 
</style> 
<style name="AppTheme.FullScreen" parent="noActionBar"> 
<item name="android:windowFullscreen">true</item> 
</style> 
<style name="noActionBar" parent="Theme.AppCompat.NoActionBar"> 
    <item name="colorPrimary">@color/colorPrimary</item> 
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item> 
    <item name="colorAccent">@color/colorAccent</item> 
</style> 
<style name="OptionDialog" parent="Theme.AppCompat.Dialog.Alert"> 

    <item name="colorAccent">#C5CAE9</item> 
    <item name="android:background">#3F51B5</item> 
    <item name="android:textColor">?android:attr/textColorPrimaryInverseDisableOnly</item> 
</style> 


<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" /> 

<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" /> 

<style name="SelectableItemTheme"> 
    <item name="colorControlHighlight">#888888</item> 
</style> 

<style name="SelectableItemBackground"> 
    <item name="android:theme">@style/SelectableItemTheme</item> 
    <item name="android:background">?attr/selectableItemBackground</item> 
</style> 


<style name="HomeTabTextStyle" 
    parent="TextAppearance.Design.Tab"> 
    <item name="android:textSize">35sp</item> 
    <item name="android:textStyle">bold</item> 
    </style> 

<!-- Action Bar Style --> 

以下のようなもので、ツールバーを含め、私のレイアウトXMLは私のJavaコードが

setContentView(R.layout.activity_home); 
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); 
    setSupportActionBar(toolbar); 

    setTitle("My App Name"); 

答えて

4
以下のようなものです

<android.support.design.widget.AppBarLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:theme="@style/AppTheme.AppBarOverlay"> 

    <android.support.v7.widget.Toolbar 
     android:id="@+id/toolbar" 
     android:layout_width="match_parent" 
     android:layout_height="110dp" 
     android:background="?attr/colorPrimary" 
     app:popupTheme="@style/AppTheme.PopupOverlay" /> 

    <android.support.design.widget.TabLayout 
     android:id="@+id/tabs" 
     app:tabTextAppearance="@style/HomeTabTextStyle" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" /> 


</android.support.design.widget.AppBarLayout> 

以下のようなものです

ツールバーは他のレイアウトのように。それは、あなたがこのようにその中の要素を追加することができます意味:

 <android.support.v7.widget.Toolbar 
     android:id="@+id/toolbar" 
     android:layout_width="match_parent" 
     android:layout_height="?attr/actionBarSize" 
     android:background="?attr/colorPrimary" 
     app:popupTheme="@style/AppTheme.PopupOverlay"> 

     <TextView 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:textSize="25sp" 
      android:textColor="@color/colorText" 
      android:gravity="center|center_horizontal" 
      android:text="@string/title_activity_my_activity"/> 

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

これは、ツールバーのタイトルのタイトルサイズを変更します。あなたの好きなように。

私はこれがあなたの目標を達成するのに役立つことを願っています!がんばろう。

UPDATE

手動アクティビティのタイトルを設定したい場合は、このようなテキストビューのIDを設定することができます。

<TextView 
     android:id="@+id/title_text" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:textSize="25sp" 
     android:textColor="@color/colorText" 
     android:gravity="center|center_horizontal" 
     android:text="@string/title_activity_my_activity"/> 

その後いつものように、

TextView title = (TextView) toolbar.findViewById(R.id.title_text); 
title.setText("New Title"); 

私はこれが助けてくれることを願っています!

+0

こんにちは!私のJavaコードを見てください...私はあなたの答えごとにそれを変更することはできますか?なぜなら私はtextviewを使用していないからです....ありがとう –

+0

上記のように、このTextViewをツールバーに追加することができ、異なるデバイスサイズの各フォルダに異なるサイズのテキストを持つことができます。 – Eenvincible

+0

ええ...私はそれを理解し、あなたの助けに感謝しますが、実際に私はこのテキストビューを使用するために私のJavaコードで何を変更すべきか尋ねていますか?私の質問に追加した私のJavaコードを確認してください...もう一度お礼申し上げます。( –

関連する問題