'입력'에 해당되는 글 2건

  1. 안드로이드 EditText에 특정(주소,이메일,숫자 등)의 타입 입력받기
  2. XE 비회원이 귀찮게 이메일 홈페이지 입력 안하도록 하기 1
안드로이드 레이아웃은 xml로 작성합니다. UI를 xml로 구성하는 것입니다. 자신이 EditText에 입력받고 싶은 특정 값이 있을 겁니다. 그 값이 숫자이면 숫자만 있는 키보드를 호출해야 하고, 이메일이면 키보드에 @를 쉽게 칠 수 있게 하는게 사소한 배려겠죠.


EditText 속성


자신이 입력받고 싶은 것을 쉽게 입력할수 있게 EditText에 속성을 넣어줄 수 있습니다. 

    <EditText

        android:id="@+id/editText1"

        android:layout_width="wrap_content"

        android:layout_height="wrap_content"

        android:layout_alignLeft="@+id/textView1"

        android:layout_below="@+id/textView1"

        android:layout_marginTop="40dp"

        android:ems="10" >

 
 소스는 대충 위처럼 생겼을 것입니다. 필요에 따라서 저 줄이 늘어나기도 아니면 줄어들기도 하죠. 자신이 원하는 editText에다. 아래 코드를 추가해보세요.

      android:inputType="자신이 원하는 타입" 

android:inputType= 은 입력할 타입을 지정하는 것입니다. 위 코드 자신이 원하는 타입이라는 문자를 지우고 자신이 원하는 타입을 아래 설명을 참고하여 넣으시면 되겠습니다.

android:inputType

The type of data being placed in a text field, used to help an input method decide how to let the user enter text. The constants here correspond to those defined by InputType. Generally you can select a single value, though some can be combined together as indicated. Setting this attribute to anything besides none also implies that the text is editable.

Must be one or more (separated by '|') of the following constant values.

ConstantValueDescription
none 0x00000000 There is no content type. The text is not editable.
text 0x00000001 Just plain old text. Corresponds to TYPE_CLASS_TEXT |TYPE_TEXT_VARIATION_NORMAL.
textCapCharacters 0x00001001 Can be combined with text and its variations to request capitalization of all characters. Corresponds to TYPE_TEXT_FLAG_CAP_CHARACTERS.
textCapWords 0x00002001 Can be combined with text and its variations to request capitalization of the first character of every word. Corresponds to TYPE_TEXT_FLAG_CAP_WORDS.
textCapSentences 0x00004001 Can be combined with text and its variations to request capitalization of the first character of every sentence. Corresponds to TYPE_TEXT_FLAG_CAP_SENTENCES.
textAutoCorrect 0x00008001 Can be combined with text and its variations to request auto-correction of text being input. Corresponds to TYPE_TEXT_FLAG_AUTO_CORRECT.
textAutoComplete 0x00010001 Can be combined with text and its variations to specify that this field will be doing its own auto-completion and talking with the input method appropriately. Corresponds toTYPE_TEXT_FLAG_AUTO_COMPLETE.
textMultiLine 0x00020001 Can be combined with text and its variations to allow multiple lines of text in the field. If this flag is not set, the text field will be constrained to a single line. Corresponds toTYPE_TEXT_FLAG_MULTI_LINE.
textImeMultiLine 0x00040001 Can be combined with text and its variations to indicate that though the regular text view should not be multiple lines, the IME should provide multiple lines if it can. Corresponds to TYPE_TEXT_FLAG_IME_MULTI_LINE.
textNoSuggestions 0x00080001 Can be combined with text and its variations to indicate that the IME should not show any dictionary-based word suggestions. Corresponds toTYPE_TEXT_FLAG_NO_SUGGESTIONS.
textUri 0x00000011 Text that will be used as a URI. Corresponds to TYPE_CLASS_TEXT |TYPE_TEXT_VARIATION_URI.
textEmailAddress 0x00000021 Text that will be used as an e-mail address. Corresponds to TYPE_CLASS_TEXT |TYPE_TEXT_VARIATION_EMAIL_ADDRESS.
textEmailSubject 0x00000031 Text that is being supplied as the subject of an e-mail. Corresponds toTYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_EMAIL_SUBJECT.
textShortMessage 0x00000041 Text that is the content of a short message. Corresponds to TYPE_CLASS_TEXT |TYPE_TEXT_VARIATION_SHORT_MESSAGE.
textLongMessage 0x00000051 Text that is the content of a long message. Corresponds to TYPE_CLASS_TEXT |TYPE_TEXT_VARIATION_LONG_MESSAGE.
textPersonName 0x00000061 Text that is the name of a person. Corresponds to TYPE_CLASS_TEXT |TYPE_TEXT_VARIATION_PERSON_NAME.
textPostalAddress 0x00000071 Text that is being supplied as a postal mailing address. Corresponds toTYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_POSTAL_ADDRESS.
textPassword 0x00000081 Text that is a password. Corresponds to TYPE_CLASS_TEXT |TYPE_TEXT_VARIATION_PASSWORD.
textVisiblePassword 0x00000091 Text that is a password that should be visible. Corresponds to TYPE_CLASS_TEXT |TYPE_TEXT_VARIATION_VISIBLE_PASSWORD.
textWebEditText 0x000000a1 Text that is being supplied as text in a web form. Corresponds to TYPE_CLASS_TEXT |TYPE_TEXT_VARIATION_WEB_EDIT_TEXT.
textFilter 0x000000b1 Text that is filtering some other data. Corresponds to TYPE_CLASS_TEXT |TYPE_TEXT_VARIATION_FILTER.
textPhonetic 0x000000c1 Text that is for phonetic pronunciation, such as a phonetic name field in a contact entry. Corresponds to TYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_PHONETIC.
textWebEmailAddress 0x000000d1 Text that will be used as an e-mail address on a web form. Corresponds toTYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS.
textWebPassword 0x000000e1 Text that will be used as a password on a web form. Corresponds toTYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_WEB_PASSWORD.
number 0x00000002 A numeric only field. Corresponds to TYPE_CLASS_NUMBER |TYPE_NUMBER_VARIATION_NORMAL.
numberSigned 0x00001002 Can be combined with number and its other options to allow a signed number. Corresponds to TYPE_CLASS_NUMBER | TYPE_NUMBER_FLAG_SIGNED.
numberDecimal 0x00002002 Can be combined with number and its other options to allow a decimal (fractional) number. Corresponds to TYPE_CLASS_NUMBER | TYPE_NUMBER_FLAG_DECIMAL.
numberPassword 0x00000012 A numeric password field. Corresponds to TYPE_CLASS_NUMBER |TYPE_NUMBER_VARIATION_PASSWORD.
phone 0x00000003 For entering a phone number. Corresponds to TYPE_CLASS_PHONE.
datetime 0x00000004 For entering a date and time. Corresponds to TYPE_CLASS_DATETIME |TYPE_DATETIME_VARIATION_NORMAL.
date 0x00000014 For entering a date. Corresponds to TYPE_CLASS_DATETIME |TYPE_DATETIME_VARIATION_DATE.
time 0x00000024 For entering a time. Corresponds to TYPE_CLASS_DATETIME |TYPE_DATETIME_VARIATION_TIME.

This corresponds to the global attribute resource symbol inputType.

Related Methods
 예를 들면 자신은 숫자 문자열을 원한다. 하면 number를 넣으면 됩니다.


 
이글이 도움이 되었다면 손가락을 눌러주세요. :) 
XE는 비회원이 글 작성할시에는 이름, 비밀번호, 이메일 그리고 홈페이지 주소를 묻습니다. 이름과 비밀번호는 필수적인 부분이지만 이메일과, 홈페이지는 굳이 필요하지도 않고 입력하기도 귀찮습니다.

XE 내부에서 자체에서 저걸 없애는 기능을 지원하지 않으니 수동으로 직접 작업해주어야 합니다.
(개인적으로 XE 1.6이나 1.7에서 이 기능이 추가되었으면 좋겠군요)

두가지 해결 방법이 있습니다.

1. 입력하는 칸을 없애기
 아얘 입력하는 칸을 없애는 방법입니다.

/modules/bored/모바일이면 m.skins, PC용이면 skins/자신이 쓰는 스킨/

write_form.html 은 게시글을 쓸 때를 당담합니다.

comment_form.html은 댓글을 쓸 때 관여합니다.

소스 편집기같은거로 여신 다음에 아래와 같은 부분을 찾아줍니다.

<li>

<label for="nText">{$lang->content}</label>

<textarea name="content" cols="20" rows="8" id="nText"></textarea>

</li>

<!--@if(!$is_logged)-->

<li>

<label for="uName">{$lang->writer}</label>

<input name="nick_name" type="text" id="uName" />

</li>

<li>

<label for="uMail">{$lang->email_address}</label>

<input name="email_address" type="text" id="uMail" />

</li>

<li>

<label for="uPw">{$lang->password}</label>

<input name="password" type="password" id="uPw" />

</li>

<li>

<label for="uSite">{$lang->homepage}</label>

<input name="homepage" type="text" id="uSite" value="http://" />

</li> 

(여기서부터는 게시판 스킨마다 다를수 있음을 알려드립니다.)

<label for="uMail"> 부분은 "이메일" 이라는 문자열을 보여주는 부분입니다.
<label for="uMail" style="display:none"이런식으로 해 주시면 "이메일"이라는 문자열이 보이지 않습니다.
다른것도 마찬가지입니다.

이메일 입력하는 칸을 보이지 않게 하시려면
 <input name="email_address" type="text" id="uMail" /> 부분에서 <input name="email_address" type="text" id="uMail" style="display:none" />이런식으로 

style="display:none"
을 붙이시면 숨기기가 가능합니다.

2. 자신이 미리 지정한 문자열로 미리 입력되게 하기


 이메일, 홈페이지 다 입력하게 하니 입력하기 귀찮아하는게 걸리고, 또 없애자니 입력하시고 싶어하시는 분이 계실 것 같다구요? 그럼 이 방법을 추천드립니다.


위 사진처럼 입력하지 않아도 자동으로 입력하게 해놓을 수 있습니다. 여기에서 자신이 이메일 주소나, 홈페이지 주소를 입력하고 싶어하시는 비회원이 계시다면 저 문자열을 지우고 할 수 있습니다.
 

 
/modules/bored/모바일이면 m.skins, PC용이면 skins/자신이 쓰는 스킨/

write_form.html 은 게시글을 쓸 때를 당담합니다.
read.html은 게시글을 보는 것과 댓글을 쓸 때 관여합니다.

소스 편집기같은거로 여신 다음에 아래와 같은 부분을 찾아줍니다.

<li>

<label for="nText">{$lang->content}</label>

<textarea name="content" cols="20" rows="8" id="nText"></textarea>

 </li>

<!--@if(!$is_logged)-->

<li>

<label for="uName">{$lang->writer}</label>

<input name="nick_name" type="text" id="uName" />

</li>

<li>

<label for="uMail">{$lang->email_address}</label>

<input name="email_address" type="text" id="uMail" />

</li>

<li>

<label for="uPw">{$lang->password}</label>

<input name="password" type="password" id="uPw" />

</li>

<li>

<label for="uSite">{$lang->homepage}</label>

<input name="homepage" type="text" id="uSite" value="http://" />

</li> 
(게시판 스킨마다 다를수 있음을 알려드립니다.) 

이메일 같은 경우에는 <input name="email_address" type="text" id="uMail" /> 처럼 입력하는 칸을 관여하는 부분에서 value="자신이 원하는 내용" 으로 해주시면 됩니다.

 
<input name="email_address" type="text" id="uMail" value="자신이 원하는 내용"/>
 

 홈페이지 같은 경우에는 value="http://"가 이미 있으므로 자신이 원하는 주소로 써주시면 됩니다.

그래서 제가 쓰고 있는 모바일 게시판 소스 일부입니다.

<li>

<label for="nText">{$lang->content}</label>

<textarea name="content" cols="20" rows="8" id="nText"></textarea>

</li>

<!--@if(!$is_logged)-->

<li>

<label for="uName">{$lang->writer}</label>

<input name="nick_name" type="text" id="uName" />

</li>

<li>

<label for="uMail">{$lang->email_address}</label>

<input name="email_address" type="text" id="uMail" value="example@example.com"/>

</li>

<li>

<label for="uPw">{$lang->password}</label>

<input name="password" type="password" id="uPw" />

</li>

<li>

<label for="uSite">{$lang->homepage}</label>

<input name="homepage" type="text" id="uSite" value="http://tarks.iptime.org" />

</li>

 게시판별로 다르다는 점 참고하시면서 사용하시면 될 것 같습니다.





손가락 누르기도 귀찮으면 무엇을 하겠습니까.
도움이 되었으면 손가락을 눌러 주세요 :)