2011-07-09 2 views
0

私のクラスはListActivityです。タイトルバーは次の画像の「サウンド設定」と同じです。そのようなタイトルを作成するための適切な方法だろう何Androidのタイトルバー

enter image description here

ありがとうございます。

答えて

3

カスタムレイアウトを作成することでこの問題を解決できます。

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 
    android:orientation="vertical" 
    <TextView android:id="@+id/textViewCategoriesTitle" 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:text="@string/categoriesTitle" 
       android:background="#123" 
       android:layout_gravity="center_horizontal" 
       android:textSize="30sp" /> 

    <ListView android:layout_height="wrap_content" 
       android:layout_width="fill_parent" 
       android:id="@+id/listViewCategories" 
       android:layout_gravity="center_vertical|center_horizontal" /> 

</LinearLayout> 

希望します。

+0

ありがとうございました@HERO、今私は同じロジックを使用しています。私はネイティブメソッドがあると思った。 – Adnan

2

あなたは、リストビューにヘッダビューを追加することができます。

getListView().addHeaderView(myTitleView); 

私はあなたがが、まったく同じ外観を得ることを確認することができますかどうかはわかりません。 TextViewを含む基本的なレイアウトを試してみて、それがどのように機能するかを見てみましょう。

関連する問題