메뉴 건너뛰기

조회 수 6905 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄 첨부
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄 첨부

MainActivity 소스

 

public class MainActivity extends Activity {

 

@Override

protected void onCreate(Bundle savedInstanceState) {

  super.onCreate(savedInstanceState);

  setContentView(R.layout.activity_main);

 

  if (savedInstanceState == null) {

   getFragmentManager().beginTransaction()

     .add(R.id.container, new PlaceholderFragment()).commit();

  }

}

 

public void sendMessage(View view) {

  Intent intent = getIntent();

  EditText editText = (EditText)findViewById(R.id.input);

  String message = editText.getText().toString();

  Toast.makeText(this,message,Toast.LENGTH_SHORT).show();

}




=====================================================================================



프레그먼트_메인.xml 소스

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.example.test.MainActivity$PlaceholderFragment" >

    <EditText 
        android:id="@+id/input"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:hint="@string/nameInput"
        />

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignTop="@+id/input"
        android:layout_marginLeft="21dp"
        android:layout_toRightOf="@+id/input"
        android:text="@string/send" 
        android:onClick="sendMessage"/>

</RelativeLayout>


=====================================================================================



strings.xml 소스

<?xml version="1.0" encoding="utf-8"?>
<resources>

    <string name="app_name">Test</string>
    <string name="action_settings">Settings</string>
    <string name="nameInput">이름을 입력하세요</string>
    <string name="send">전송</string>

</resources>


=====================================================================================

실행화면








  1. 버튼 누르면 이미지 바꾸기

    Date2015.07.26 Views6622
    Read More
  2. 내가 입력한 글자 Toast로 나오게 하기

    Date2015.07.26 Views6905
    Read More
  3. Android Navigation Drawer API 공개! 디자인 가이드 살펴보기

    Date2015.07.29 Views8144
    Read More
  4. manifest 의 launchMode 속성

    Date2015.08.11 Views7578
    Read More
  5. [안드로이드 강좌] 초보자들이 많이 하는 실수

    Date2015.08.11 Views6837
    Read More
  6. 안드로이드 기본어플 예제 어플소스 모음

    Date2015.08.17 Views8870
    Read More
  7. [안드로이드] 콘텍스트 메뉴 사용예제

    Date2015.09.03 Views7350
    Read More
  8. [안드로이드] 팝업메뉴 사용법

    Date2015.09.03 Views9394
    Read More
  9. [안드로이드] 빠르게 사용할수 있는 컨텍스트 메뉴 만들기

    Date2015.09.03 Views6809
    Read More
  10. [안드로이드] 리스트 뷰의 한 항목에 대한 컨텍스트 메뉴 만들기

    Date2015.09.04 Views9098
    Read More
  11. 안드로이드 로그인 화면 만들기

    Date2015.09.05 Views8049
    Read More
  12. JAVA JDBC를 사용하여 MySQL과 연동

    Date2015.11.21 Views8657
    Read More
  13. 안드로이드 EditText 필터링 검색 구현(adapter.getFilter().filter(cs))

    Date2015.12.14 Views8786
    Read More
  14. 안드로이드 EditText 필터링 검색

    Date2015.12.14 Views7694
    Read More
  15. Android Push GCM 서버 구성 하기(3)

    Date2015.12.14 Views6395
    Read More
  16. 안드로이드 로그인유지 코드

    Date2015.12.14 Views8813
    Read More
  17. Android] 안드로이드 홈 디렉토리 알아내기

    Date2015.12.15 Views6906
    Read More
  18. Android] Fragment 내부의adapter에서 startActivity 하기

    Date2015.12.15 Views6501
    Read More
  19. Android TIP] strings.xml 에서 특수문자 사용하기

    Date2015.12.15 Views6634
    Read More
  20. 안드로이드] 페이스북 같은 슬라이드 메뉴 만들기

    Date2015.12.15 Views12548
    Read More
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 ... 13 Next
/ 13

하단 정보를 입력할 수 있습니다

© k2s0o1d4e0s2i1g5n. All Rights Reserved