0

I have created app with similar functionality to a browser. This is what I have right now:

actionbar

Whenever user clicks on the edittext(the one with google.com inside it) i want to to take all of the space in actionbar covering overflow button and other icons(those are menu items as well).

Is there any way way I could do that? So far I have tried setting the layout-weight of the edittext to 1 but it does not work. The custom view inside actionbar is an linear layout like this one here:

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

<EditText xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/searchfield"
    android:layout_width="0dip"
    android:layout_weight="1"
    android:layout_height="match_parent"
    android:background="@android:color/transparent"
    android:imeOptions="actionGo"
    android:inputType="textWebEmailAddress"
    android:text="www.google.com" />
</LinearLayout>

I should also mention that i want to do it programatically.

Thanks guys

John Smith
  • 844
  • 8
  • 26

1 Answers1

0

You can hide these icons by following topic: How do I hide a menu item in the actionbar?

I think you can easily hide the actionbar when click, something like:

ActionBar actionBar = getActionBar(); //OR getSupportActionBar();
actionBar.hide();

Then bring it back when you need it by using:

actionBar.show();
Community
  • 1
  • 1
xxx
  • 3,315
  • 5
  • 21
  • 40
  • The problem is that the edittext is inside that actionbar as well. Wouldn't this hide the edittext as well? – John Smith Jun 20 '16 at 15:24