2016-12-30 11 views
1

私の編集テキストにヒントが表示されますが、カーソルとタイピングのための領域が表示されません。どのようにすればカーソルと領域だけでなくヒントを表示するのでしょうか?edittextカーソルと編集領域が表示されない

<?xml version="1.0" encoding="utf-8"?> 
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:id="@+id/activity_main_menu" 
android:layout_width="match_parent" 
android:layout_height="fill_parent" 
android:background="@drawable/numberborder" 
tools:context="com.example.light.primenumbercompanion.MainMenu"> 
<RelativeLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" > 
    <TextView 
     android:id="@+id/checker" 
     android:layout_width="230dp" 
     android:layout_height="wrap_content" 
     android:gravity="center" 
     android:textColor="@color/black" 
     android:textStyle="bold" 
     android:layout_marginTop="37dp" 
     android:layout_marginLeft="20dp" 
     android:layout_marginBottom="37dp" 
     android:text="@string/checker" 
     android:textSize="20sp"/> 
    <TextView 
     android:id="@+id/checkerQeustion" 
     android:layout_below="@id/checker" 
     android:layout_width="230dp" 
     android:layout_height="wrap_content" 
     android:textColor="@color/black" 
     android:textStyle="bold" 
     android:layout_marginLeft="20dp" 
     android:layout_marginBottom="5dp" 
     android:text="@string/checkerQuestion"/> 
    <EditText 
     android:layout_width="200dp" 
     android:layout_height="wrap_content" 
     android:layout_marginLeft="20dp" 
     android:layout_marginBottom="5dp" 
     android:id="@+id/checkerInput" 
     android:layout_below="@id/checkerQeustion" 
     android:hint="@string/checkerInput" 
     android:inputType="number"/> 


</RelativeLayout> 

あなたがいたが、それが正常に動作します私はあなたのコードを実行した私のコードをコピーして、ユーザーがどこ入力にあなたの活動には問題はありません数

+0

ここで私が見つけたことは間違っていません。私はカーソルとデフォルトのedittextの両方にボーダーの下線を見ることができます。スクリーンショットを追加できますか? '@ drawable/numberborder'の場合、背景がデフォルトのedittextの背景と混同している可能性があります。 –

答えて

1

を知ることができませんような気がしますスクロール・ビューを閉じないでください。最初にクローズするか、スクロール・ビューを閉じるコードを送信してJavaを送信することを忘れてしまいます。

<?xml version="1.0" encoding="utf-8"?> 
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:id="@+id/activity_main_menu" 
android:layout_width="match_parent" 
android:layout_height="fill_parent" 
> 
<RelativeLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" > 
    <TextView 
     android:id="@+id/checker" 
     android:layout_width="230dp" 
     android:layout_height="wrap_content" 
     android:gravity="center" 
     android:textColor="#000000" 
     android:textStyle="bold" 
     android:layout_marginTop="37dp" 
     android:layout_marginLeft="20dp" 
     android:layout_marginBottom="37dp" 
     android:text="Heading text" 
     android:textSize="20sp"/> 
    <TextView 
     android:id="@+id/checkerQeustion" 
     android:layout_below="@id/checker" 
     android:layout_width="230dp" 
     android:layout_height="wrap_content" 
     android:textColor="#000000" 
     android:textStyle="bold" 
     android:layout_marginLeft="20dp" 
     android:layout_marginBottom="5dp" 
     android:text="textview"/> 
    <EditText 
     android:layout_width="200dp" 
     android:layout_height="wrap_content" 
     android:layout_marginLeft="20dp" 
     android:layout_marginBottom="5dp" 
     android:id="@+id/checkerInput" 
     android:layout_below="@id/checkerQeustion" 
     android:hint="testedittext" 
     android:inputType="number"/> 


</RelativeLayout> 
</ScrollView> 
+0

ありがとう、プレビューは私をだました!!!!! –

0

あなたがXMLであなたののEditTextタグ内に以下の行を追加することができますあなたのEditTextのカーソルの色を変更したい場合は

android:textCursorDrawable="@drawable/cursor_color" 

cursor_color.xml

<?xml version="1.0" encoding="utf-8"?> 
<shape xmlns:android="http://schemas.android.com/apk/res/android"> 
    <size android:width="3dp" /> 
    <solid android:color="#000000" /> 
</shape> 

私のデフォルトの色は黒で、色は自由に変更できます。 それがあなたのために働いた場合は、私に教えてください。

+1

これは、カーソルの色が「白」の背景と同じで、そこに表示されない可能性があります。 @シーナラフィエイ –

関連する問題