• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Search - combine textview with imagebutton

tanion

Lurker
Hi! I'm new to this forum and is kind of a n00b when it comes to android development, but very familiar with Oracle Java.

So i've just begun developing my first app and have a question. How do I combine a TextView with an ImageButton so it looks like one component (in gui)? I dont know what I'm doing wrong but my components still look a 2 separate items. I want it to look like this but it looks as below.

Here is the code for the layout.

Code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
   xmlns:android="http://schemas.android.com/apk/res/android"
   android:orientation="vertical"
   android:layout_width="fill_parent"
   android:layout_height="fill_parent"
   >
      <LinearLayout 
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:addStatesFromChildren="true"
        android:gravity="center_vertical"
        android:paddingTop="5dip"
        android:paddingLeft="5dip"
        android:paddingRight="5dip" 
        android:background="@drawable/search_bg"
        >
       <AutoCompleteTextView 
            android:id="@+id/search_text"
            android:hint="S
 

Attachments

  • search.png
    search.png
    17.2 KB · Views: 65
My guess is that you have to use a custom 9-patch drawable for the imagebutton's background property.
I don't know if there is a standard drawable available that does that but let me know if you find it. I can use it too :)
 
I'm not sure but i dont think this has to do with drawables. I havent yet taken care of the actual search. Could this be it?
 
Back
Top Bottom