没有EditText视图是可点击的

时间:2014-09-15 02:57:30

标签: android android-layout android-edittext

我花了很多时间进行实验,但我无法实现这一目标。我添加到线性布局的任何类型的编辑文本都无法单击。奇怪的是它看起来很集中(我把它放在我的代码中)。 我一直无法让键盘弹出,如果我隐藏它并使可见的旋转器具有相同的属性,那么奇怪的部分就是 - 微调器的弹出窗口工作。 注意:下面是AutocomletetextBox,但是当它只是EditTextBox而我注释掉了 - 适配器的东西。仍然无法正常工作,甚至没有弹出键盘。

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);

1 个答案:

答案 0 :(得分:1)

在autocompletiontextview中删除此行一切正常

 android:textIsSelectable="true"