2014-09-15 6 views
0

Я провел кучу времени, экспериментируя, и я не могу заставить это работать. Любой тип текста редактирования, который я добавляю в свой линейный макет, не может быть нажат. Странная часть - это выглядит сфокусированным (что я ввел в свой код). Мне не удалось получить даже клавиатуру, чтобы открыть ее, странная часть, если я скрою ее и сделаю видимым прядильщик с теми же атрибутами - всплывающее окно spinner. Примечание: ниже это AutocomletetextBox, но когда это был просто EditTextBox, и я прокомментировал - материал адаптера. Все еще не работал, даже не всплывал на клавиатуре.No EditText view is clickable

enter image description here

Вот мой код

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical" 
    android:weightSum="1"> 

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     xmlns:tools="http://schemas.android.com/tools" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     tools:context="com.example.edu.testversion.activity.CategoryChooser" 
     tools:ignore="MergeRootFrame" 
     android:id="@+id/frameLayout" 
     android:orientation="horizontal"> 

     <Button 
      style="?android:attr/buttonStyleSmall" 
      android:layout_width="90dip" 
      android:layout_height="wrap_content" 
      android:text="@string/button_start_map" 
      android:id="@+id/play_game_button" 
      android:layout_gravity="right|top" 
      android:theme="@style/AppTheme" 
      android:layout_marginTop="10dip" 
      android:visibility="gone" /> 

     <Spinner 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:id="@+id/game_spinner" 
      android:layout_gravity="left" 
      android:spinnerMode="dialog" 
      android:theme="@style/AppTheme" 
      android:layout_marginTop="5dip" 
      android:visibility="gone" /> 

     <TextView 
      android:layout_width="fill_parent" 
      android:layout_height="47dp" 
      android:text="Which way do you want to play the game?" 
      android:layout_gravity="center_vertical" 
      android:id="@+id/get_started_dialog" 
      android:typeface="monospace" 
      android:singleLine="false" 
      android:textIsSelectable="false" 
      android:textSize="@dimen/activity_horizontal_margin" 
      android:layout_marginLeft="5dp" 
      android:clickable="false" 
      android:enabled="false" 
      android:focusable="false" 
      android:textAlignment="textEnd" 
      android:layout_marginTop="10dp" /> 

     <TextView 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_gravity="center_vertical" 
      android:minHeight="20dip" 
      android:id="@+id/restaurant_name_display" 
      android:typeface="monospace" 
      android:singleLine="false" 
      android:textIsSelectable="false" 
      android:textSize="@dimen/activity_horizontal_margin" 
      android:layout_marginLeft="5dp" 
      android:clickable="true" 
      android:visibility="gone" 
      android:enabled="false" 
      android:focusable="false" 
      android:textAlignment="textEnd" 
      android:layout_marginTop="3dp" /> 


     <AutoCompleteTextView 
      android:completionThreshold="3" 
      android:textIsSelectable="true" 
      android:id="@+id/find_location_dropdown" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:clickable="true" 
      android:minWidth="160dip"/> 
     <!--android:layout_gravity="center_vertical" 
     android:typeface="monospace" 
     android:textSize="@dimen/activity_horizontal_margin" 
     android:layout_marginLeft="5dp" 
     android:textAlignment="textEnd" 
     android:visibility="gone" 
     android:layout_marginTop="3dp" /> 
     --> 


    </LinearLayout> 

    <fragment 
     android:id="@+id/map" 
     android:layout_width="match_parent" 
     android:layout_height="416dp" 
     class="com.google.android.gms.maps.MapFragment" 
     android:layout_weight="3.25" /> 

И единственный код, который касается именно в моем OnCreate:

mAutocompleteLocation = (AutoCompleteTextView) findViewById(R.id.find_location_dropdown); 
     ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,android.R.layout.simple_dropdown_item_1line,androidBooks); 
     mAutocompleteLocation.setThreshold(3); 
     mAutocompleteLocation.setAdapter(adapter); 
     mAutocompleteLocation.setCompletionHint("FUN!"); 
     mAutocompleteLocation.setFocusable(true); 
     mAutocompleteLocation.setClickable(true); 
     mAutocompleteLocation.setVisibility(View.VISIBLE); 
+0

Исправьте свой xml-код. Есть ошибки, и ваш скриншот на самом деле не совпадает с кодом. – chjarder

ответ

1

удалить эту строку в autocompletiontextview все работает отлично

android:textIsSelectable="true" 
+0

Спасибо! Почему TextIsSelectable не работает? Что это за функция? – jQwierdy

+0

это может иметь какое-то отношение к этому свойству переопределения вводов жестов, поэтому, когда вы нажимаете на него, оно не отвечает. вам это не нужно, но оно используется только для TextViews. Вы можете выбрать контент EditText просто путем длительного нажатия. – chjarder