2016-10-21 64 views
0

我在日期編輯文本上創建,點擊該日期對話框將打開,用戶可以選擇日期,這不應該是可編輯的。我們正在使用外部鍵盤來執行此操作。焦點不能在卡片視圖頂部工作

通過使用鍵盤焦點不會來到這個編輯文本,但觸摸這是工作。

<android.support.design.widget.TextInputLayout 
       android:layout_weight="1" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content"> 
       <com.eevoskos.robotoviews.widget.RobotoEditText 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_gravity="center_vertical" 
        android:id="@+id/etDate" 
        style="@style/EditTextStyle" 
        android:layout_marginRight="4dp" 
        android:layout_weight="1" 
        android:singleLine="true" 
        android:hint="Date" 
        android:focusable="false" 
        android:textColor="@color/black" 
        android:textSize="21sp" 
        android:textStyle="bold" 
        app:typeface="condensed" /> 
      </android.support.design.widget.TextInputLayout> 

android:focusable="false" 

如果我將焦點設置爲true,編輯文本將變爲可編輯的而我不想要。

回答

0

我曾面臨這個問題有很多,對於編輯文本,您可以使用

edTimeTaken.setInputType(InputType.TYPE_NULL); 

這並不讓鍵盤打開。

+0

這不是我想要的,如果我們把InputType.TYPE_NULL,它是採取任何輸入。我希望editText應該是可以調焦但不可編輯的。 –

+0

這是工作,至少嘗試一次。 – theLazyFinder

+0

我試了一下夥計,沒有按要求工作。 –