0
<LinearLayout
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true"
    android:layout_alignParentRight="true"
    android:layout_alignParentEnd="true">
    <TabHost
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/tabHost"
        android:layout_gravity="center_horizontal"
        android:background="#FFFFFF">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">
            <TabWidget
                android:id="@android:id/tabs"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="#F44336"/>
            <FrameLayout
                android:id="@android:id/tabcontent"
                android:layout_width="match_parent"
                android:layout_height="match_parent">

                <LinearLayout
                    android:id="@+id/tab1"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:orientation="vertical">
                    <AutoCompleteTextView
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:id="@+id/autoCompleteTextView"
                        android:imeOptions="actionNext"
                        android:layout_below="@+id/textView"
                        android:clickable="true"/>
                    <Button
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:id="@+id/bt"
                        android:text="@string/Buscar"/>
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:id="@+id/tv1"
                        android:text="@+id/text1"
                        android:textColor="#212121"/>
                    <Button
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:id="@+id/btnmapa"
                        android:text="@string/mapa"/>
                </LinearLayout>

Here is the xml from first tab(the LinearLayour) in a tabHost. Can´t interact with this first but, actually i can with the others. Any suggestion?

public class MainActivity extends Activity {
TabHost tabHost;
private static Button but1;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    //Autocompletar búsqueda
    AutoCompleteTextView auto = (AutoCompleteTextView) findViewById(R.id.autoCompleteTextView);

    String[] lineas = getResources().getStringArray(R.array.lineas_array);

    ArrayAdapter<String > adapter;
    adapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,lineas);

    auto.setThreshold(1);
    auto.setAdapter(adapter);
    auto.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
            // TODO Auto-generated method stub
            Toast.makeText(getApplicationContext(), (CharSequence) arg0.getItemAtPosition(arg2), Toast.LENGTH_LONG).show();
        }
    });
    auto.requestFocus();
    InputMethodManager imm = (InputMethodManager)this.getSystemService(Service.INPUT_METHOD_SERVICE);
    imm.showSoftInput(auto, 0);

    tabHost=(TabHost)findViewById(R.id.tabHost);

    //Tab1
    tabHost.setup();
    TabSpec ts1=tabHost.newTabSpec("Tab1");
    ts1.setIndicator("Paradas");
    ts1.setContent(R.id.tab1);
    tabHost.addTab(ts1);

Here is my my java code too because I think it could be smth related to the way I implemented the AutoCompleteTextView that fits in that first tab.

  • Can you post the code you're using to interact with the layout? – Rieekan Oct 21 '15 at 20:17
  • @Rieekan I have updated it – Sergio Paniego Oct 21 '15 at 20:25
  • Okay, I'm running your code without error. What exactly do you mean when you say "I can´t interact with my first tab". What are you wanting to do with/to your tab? – Rieekan Oct 21 '15 at 21:43
  • I'm able to enter text, and click the buttons in the tab. Are you wanting to switch tabs? Have you tried adding a second tab to the tab host? – Rieekan Oct 21 '15 at 21:53
  • @Rieekan I actually have 3 tabs inside that tabhost, I can navigate through all of then and interact with the elements inside then while I run it on the computer but if I move it to a phone, the first tab doesn´t do anything when I interact with the buttons inside. Furthermore, when I input something in the keyboard it looks like it´s running but the words are not showed on the screen – Sergio Paniego Oct 22 '15 at 07:55
  • Even when I press the back button to close the keyboard, I am not able to make it appear again @Rieekan – Sergio Paniego Oct 22 '15 at 07:56
  • Can you describe the desired behavior using a Use Case Scenario? – Rieekan Oct 23 '15 at 23:49

0 Answers0