2017-05-31 47 views
0
<EditText 
    android:id="@+id/searchTextView" 
    android:layout_width="match_parent" 
    android:layout_height="40dp" 
    android:layout_centerVertical="true" 
    android:layout_marginLeft="@dimen/marginSmall" 
    android:layout_toLeftOf="@+id/searchCloseIcon" 
    android:layout_toRightOf="@+id/searchIcon" 
    android:background="@drawable/rounded_rect_white" 
    android:backgroundTint="@android:color/transparent" 
    android:gravity="center_vertical" 
    android:hint=" Search Nearby Chat" 
    android:inputType="text" 
    android:lines="1" 
    android:maxLines="1" 
    android:textColor="@color/black" 
    android:textColorHint="@color/black38" 
    android:textSize="@dimen/sunheading" /> 

起初我可以看到的EditText光標之後,但設置其知名度了 和 再犯可見其不可見的EditText後的EditText可見。遊標未設置能見度可見

我可以知道什麼可以解決這個問題嗎?

+0

檢查顏色在你的主題,你可以口音與背景顏色具有相同的顏色。這就是爲什麼你的光標不可見 –

回答

0

當你設置你的容器的知名度也可見嘗試請求聚焦到你的EditText

findViewById(R.id.searchTextView).requestFocus(); 
0

顯示光標,

 android:cursorVisible="true" 
     android:focusable="true" 
     android:focusableInTouchMode="true" 

,並在你的EditText,使用屬性:既要繪製

android:textCursorDrawable="@drawable/blue_cursor" 

android:textCursorDrawable設置爲致敬@null應導致使用android:textColor作爲光標顏色

編程

searchTextView.setCursorVisible(true); 
searchTextView.requestFocus(); 
+0

這並不能解決我的問題:( – Simon

+0

比你可能需要做它programatecally –

+0

@Simon檢查更新回答 –

0

機器人:textCursorDrawable = 「@繪製/ color_cursor」