2013-04-15 6 views
0

안녕하세요, 내 EditText 상자를 내 ScrollView 위에 놓아서 사용자가 여전히 아래로 스크롤 할 수 있지만 같은 시간에 여전히 고정 된보기에서 EditText를 볼 수 있습니다. 어떻게해야합니까?//ScrollView 아래 EditText 상자의 코드?

이 내 코드에서

<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:background="#000000" 
    tools:context=".BitActivity" > 

<EditText 
       android:id="@+id/input" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_alignParentLeft="true" 
       android:layout_alignParentRight="true" 
       android:layout_alignParentTop="true" 
       android:ems="10" 
       android:gravity="center" 
       android:hint="Type In Your Value" 
       android:inputType="numberDecimal" 
       android:textColor="#2FB3E3" 
       android:textSize="30px" > 
       <requestFocus /> 
      </EditText> 

    <ScrollView 
     android:id="@+id/scrollView1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentRight="true" 
     android:layout_alignParentTop="true" > 

     <RelativeLayout 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" > 



      <TextView 
       android:id="@+id/byte1" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_alignParentLeft="true" 
       android:layout_alignParentRight="true" 
       android:layout_below="@+id/input" 
       android:gravity="center" 
       android:text="Please Enter a Value" 
       android:textAppearance="?android:attr/textAppearanceLarge" 
       android:textColor="#FFFF00" 
       android:textSize="40px" /> 

     </RelativeLayout> 
    </ScrollView> 

</RelativeLayout> 
+0

와우 당신은 내 대답을 downvote에 서둘러 어쨌든 그것을 시도하지 않은 것에 대한 미안하지만, textview와 겹친다. – user2283550

답변

0

당신의 ScrollView 당신이 android:layout_alignParentTop="true" 있습니다. 하지만 ScrollView 부모는 RelativeLayout이며 RelativeLayout (화면 상단)의 상단에 ScrollView의 상단이 정렬됨을 의미합니다.

에 한번 교체 당신이 가진 현재의 ScrollView ::

<ScrollView 
    android:id="@+id/scrollView1" 
    android:layout_width="fill_parent" 
    android:layout_height="match_parent" 
    android:layout_alignParentBottom="true" 
    android:layout_alignParentLeft="true" 
    android:layout_alignParentRight="true" 
    android:layout_below="@id/input" 
> 

열쇠는 여기에이 라인 : android:layout_below="@id/input" 단지 ID가 "input"와 View의 바닥 아래 ScrollView의 상단을 맞 춥니 다.

+0

나는 어떻게 시작 해야할지 고민해야한다. Relativelayout과 edittext가 있고 거기에 긴 텍스트를 담을 스크롤 텍스트가 있습니까? – user2283550

+0

@ user2283550 무슨 뜻인지 확실하지 않습니다. 텍스트 위의 EditText를 원하십니까? 그리고 EditText 아래의 스크롤 가능한보기의 텍스트? 그래서 EditText를 스크롤 할 때 화면 상단에 머물러 있습니까? – MAV

+0

예 네가 네가해야 할 일 위에 말한 것을 못을 박거나 내가 다른 것을 시도해야 하는가? – user2283550