2013-04-11 20 views
8

アクションバーに横の進行状況バーが表示されています。 私の問題は、進行状況バーの幅がアクションバーの幅ではなく、より小さい(ただし中央になる)ことです。それは正常な行動ですか?どのように画面の幅を与えることができますか?アクションバーの横方向の進行状況バーの幅

私は私の方法でのonCreate

requestWindowFeature(Window.FEATURE_PROGRESS); 

と、この中で事前に

public void setShowIndeterminateProgress(boolean val) { 
    setProgressBarIndeterminate(true); 
    setProgressBarVisibility(val); 
} 

おかげでこれを使用しています。

+0

エミュレータと少なくとも2つの異なるデバイスでテストを試みましたか? – d3dave

+0

あなたはその画面を置くことができますか? –

答えて

0

メニューからすべての項目を削除する必要があります。

@Override 
public boolean onCreateOptionsMenu(Menu menu) { 
    MenuInflater inflater = getMenuInflater(); 
    //inflater.inflate(R.menu.main, menu); 
    ActionBar actionBar = getActionBar(); 
    actionBar.setDisplayHomeAsUpEnabled(false); 
    actionBar.setDisplayShowHomeEnabled(false); 
    actionBar.setDisplayShowCustomEnabled(false); 
    actionBar.setDisplayShowTitleEnabled(false); 
    //actionBar.setIcon(R.drawable.ic_launcher); 

    LayoutInflater inflator = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); 
    View view = inflator.inflate(R.layout.actionbar_main, null); 

    //actionBar.setCustomView(view); 
    return true; 

} 

その後、プログレスバー付きのxmlレイアウトを作成します。それはwidth = "match_parent"です。 actionBar.setCustomViewとこのメソッドのコメントを解除して、独自のカスタムビューでactionBarを拡張します。

これを試してみて、私に歌をお願いします。

2

アクションバースタイルには、属性android:progressBarPaddingがあります。 0dipに設定します。

<style name="MyActionBar" parent="@android:style/Widget.Holo.ActionBar"> 
    <item name="android:progressBarPadding">0dip</item> 
</style> 
関連する問題