[ Android.editText 하단라인 보이기.안보이게 하기 ]

 

1. 정의

    - EditText의 기본은 전체 4각형 Box에 하단 라인이 기본적으로 보이게 된다.

    - focus가 위치하는 EditText의 하단라인은 핑크색

    - focus를 잃었은 EditText의 하단라인은 진한회색

 

2. 하단라인 없애기

    - [ android:background="??" ] 속성을 기술하면 하단라인이 보이지 않는다.

    - [ android:background="??" ] 속성을 기술하지 않으면 하단라인이 보인다.

 

3. 화면

    - 왼쪽     화면은 하단 라인이 보이기

       . background 속성을 기술하지 않았음.

       . focus가 위치하는 EditText의 하단라인은 핑크색

       . focus를 잃었은 EditText의 하단라인은 진한회색

    - 오른쪽 화면은 하단 라인 안보이게 하기

       . 아이디 입력 EditText는  [ android:background="@null" ] 으로 처리

       . 비밀번호 입력 EditText는  [ android:background="#d7d5d7" ](회색) 으로 처리

      

   

 

 

 

 

'[Android] - 위젯 > EditText' 카테고리의 다른 글

키보드 보이게 하기  (0) 2017.01.02
Focus 막기. Editting 안되게 하기  (0) 2017.01.02
포커스 주기  (0) 2017.01.02
숫자 관련  (0) 2017.01.01
Posted by 농부지기
,

** 위젯 Border 입히기 **

 

 

1. 정의

    - 위젯(Layout, TextView, EditBox ...)들에게 Border를 줄 수 있다.

    - Border를 줄때 테두리뿐만 아니라  backgounrd, margin등을 설정할 수 있다.

 

2. 개발방법

    2.1 res/drawable/border.xml 파일 생성

    2.2 activity_main.xml 파일에서 border를 입히고 싶은 위젯에 

         [android:background="@drawable/border_calbutton"]설정하면 됨


3. res/drawable/border.xml 파일

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!-- 설정된 위젯의 background를 설정
1. 아래 body설정 부분에서 전체영역이 설정 되면 이 background는 아무 표시가 안난다.
2. 아래 body설정 부분에서 top, bottom에 2dp씩 설정 되었기에
이 2dp만큼 아래 부분에 설정된 모양(oval)과 색깔(#6a00ff)이 보인다.
-->
<item>
<shape android:shape="oval">
<solid android:color="#6a00ff" />
</shape>
</item>

<!-- 설정된 위젯의 Body를 설정
1. top, bottom 에 2dp 설정
2. shape : body를 사각형으로 설정
3. color : body에 color지정
-->
<item android:top="2dp" android:bottom="2dp">
<shape android:shape="rectangle">
<solid android:color="#eeffffff" />
</shape>
</item>
</layer-list>

 4. activity_main.xml 파일에서 background를 이용해서 설정

     - RelativeLayout에서도 설정할 수 도있고,  button에도 설정할 수 있다.

 <RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="@drawable/border"
android:layout_weight="1">

<Button
android:id="@+id/bt_clear"
android:text="농부지기"
android:layout_marginLeft="30dp"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:background="@drawable/border"/>


</RelativeLayout>
Posted by 농부지기
,

* 키보드 보이게 하기

 

   - 한글, 숫자 키보디 임

1. Java단에서 아래 두 줄 추가
    InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY);

 

'[Android] - 위젯 > EditText' 카테고리의 다른 글

Android.editText 하단라인 보이기.안보이게 하기  (0) 2017.01.30
Focus 막기. Editting 안되게 하기  (0) 2017.01.02
포커스 주기  (0) 2017.01.02
숫자 관련  (0) 2017.01.01
Posted by 농부지기
,

* marquee  (글씨 흐르기)

 

1. Layout 에서

    <TextView
        android:id="@+id/tv_mqrquee"
        android:text="농부 글씨 흐리기..예전에는 logic으로했는데... "


        android:ellipsize="marquee"
        android:focusable="true"
        android:marqueeRepeatLimit="marquee_forever"
        android:singleLine="true"/>

 

2. 위 Layout과 추가적으로 Java단에서  아래를 해줘야 됨
      ((TextView)findViewById(R.id.tv_mqrquee)).setSelected(true);



Posted by 농부지기
,

* Focus 막기. Editting 안되게 하기

 

1. java단에서 - 첫번째 방법

    editText_name.setFocusableInTouchMode(false);  //결과 box에 edit막기

 

 

2. java단에서 - 두번째 방법

                     - key를 눌러도 EditText 에 값이 안찍힘

                     - 단점 : 하지만 keypad가 보임

    editText_name.setKeyListener(null); 

 

 

'[Android] - 위젯 > EditText' 카테고리의 다른 글

Android.editText 하단라인 보이기.안보이게 하기  (0) 2017.01.30
키보드 보이게 하기  (0) 2017.01.02
포커스 주기  (0) 2017.01.02
숫자 관련  (0) 2017.01.01
Posted by 농부지기
,

* EditText 에 Focus(cursor)주기

 

1. Java단에서

    editText_Name.requestFocus();

 

 

'[Android] - 위젯 > EditText' 카테고리의 다른 글

Android.editText 하단라인 보이기.안보이게 하기  (0) 2017.01.30
키보드 보이게 하기  (0) 2017.01.02
Focus 막기. Editting 안되게 하기  (0) 2017.01.02
숫자 관련  (0) 2017.01.01
Posted by 농부지기
,

* EditText

 

-. layout.xml 파일

   1. 숫자 키보드를 우선적으로 띄우기

       - android:inputType="number"

       - 추가 속성 : number / numberSigned / numberDecimal

       - 단점 : 숫자 keypad는 띄우지만, ctrl+V등을 문자를 입력하면  입력 됨

 

   2. 숫자만 입력 받기

       - android:digits="0123456789"

 

  

 

 

 

Posted by 농부지기
,