3

For example :

If I want to use a SearchView on ActionBar, how can I set the width to the ActionView?

I have tried setLayoutParams,it is not effective.The width I want to set is stubborn holding the constant width all the time.I don't know how can I change it.plz help me.

<item
    android:id="@+id/documents_action_search"
    android:icon="@drawable/ic_action_search"
    android:orderInCategory="100"
    android:title="@string/documents_action_search"
    holo:actionViewClass="android.support.v7.widget.SearchView"
    holo:showAsAction="always"/>

Addition: I can get the searchview by getacitonview in my code, and set the LayoutParams, and it is not worked.

Ravi
  • 34,851
  • 21
  • 122
  • 183

0 Answers0