Setting up EditText with “url” inputType

2019-02-08 07:31发布

问题:

I am trying to make an EditText such that when i click it a key board containing ".com" appears because a url is to be intered into the EditText. I tried to use this: android:inputType="textUri" but it is not working. How do i do it?

回答1:

try this one

<EditText 
        android:id="@+id/edt"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:inputType="textWebEmailAddress"
        />

android:inputType="textWebEmailAddress" use this property for that.



回答2:

You can use inputType as textWebEmailAddress or textEmailAddress. Specs say it is device dependent but honestly I did not find any difference. Purpose of using this is you can use the @ and .com keys in the keypad. I tried both on samsung Galaxy S5 and keypad is the same.