2014-03-29 3 views
-4

내가 매우 biginner 그래서메모장을 텍스트 뷰로 사용하려면 어떻게해야합니까?

처음 내 프로젝트에이 개 활동을

제발 베어하고있어 text1.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    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=".Text1" > 

    <Button 
     android:id="@+id/button1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentTop="true" 
     android:layout_centerHorizontal="true" 
     android:layout_marginTop="36dp" 
     android:text="Button1" /> 

    <Button 
     android:id="@+id/button3" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignLeft="@+id/button2" 
     android:layout_below="@+id/button2" 
     android:layout_marginTop="82dp" 
     android:text="Button3" /> 

    <Button 
     android:id="@+id/button2" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignLeft="@+id/button1" 
     android:layout_below="@+id/button1" 
     android:layout_marginTop="70dp" 
     android:text="Button2" /> 

</RelativeLayout> 

이고, 두 번째는 text2.xml입니다 :

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" > 

    <TextView 
     android:id="@+id/textView1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentRight="true" 
     android:layout_alignParentTop="true" 
     android:layout_marginRight="20dp" 
     android:layout_marginTop="28dp" 
     android:text="TextView" /> 

</RelativeLayout> 

내 프로젝트에 3 메모장을 넣으려면 text1.xml의 첫 번째 단추를 누를 때 text2.xml의 textview에 표시된 첫 번째 메모장과 사용자가 secon Text1.xml의 d 버튼 text2.xml의 textview에 표시된 두 번째 메모장과 1과 2 같은 3 번째 메모장 ..... 메모장에서 텍스트를 텍스트에 추가 할 수있는 방법은 무엇입니까? 프로젝트에 메모장을 추가해야하는 곳은 어디입니까? 자산에 ???

+0

u는 동일한 활동을 다시 사용할 수 있으며 많은 활동을 생성하는 agian입니다. – KOTIOS

+0

예 ... 방금 활동했습니다 ... 처음에는 제 단추와 두 번째 textview ...... 어떻게 텍스트를 추가 할 수 있습니까? 텍스트 뷰에 메모장? 코드 란 무엇입니까? – user3410344

+0

그냥 원하는 데이터를 읽고 그냥 setText 메서드를 사용하여 textview 텍스트를 – KOTIOS

답변

0

당신은 framelayout/relativelayout을 사용하여 서로 다른 메모장을 배치하고 버튼을 사용하여 특정 레이아웃의 가시성을 토글 할 수 있습니다.