2016-08-04 3 views
0

내 레이아웃에 EditText 세 개 있습니다. 그 중 하나를 클릭하면 레이아웃이 축소되고 두 번째 레이아웃은 거의 보이지 않습니다. 두 번째 레이아웃 ("친애하는 학부모")을 클릭하면 키보드가 마지막 edittext (선생님 이름)와 겹쳐 야하고 마지막 편집 텍스트를 클릭하면 키보드 위에 나타나야합니다. 여기키보드 축소 EditText

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:card_view="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="@color/actionbar_title_color" 
    android:orientation="vertical"> 

    <include 
     android:id="@+id/include" 
     layout="@layout/toolbar" /> 

    <android.support.v7.widget.CardView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_marginBottom="25dp" 
     android:layout_marginLeft="25dp" 
     android:layout_marginRight="25dp" 
     android:layout_marginTop="25dp" 
     card_view:cardElevation="10sp" 
     card_view:cardUseCompatPadding="true"> 

     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 

      android:background="#ffffff" 
      android:orientation="horizontal"> 

      <LinearLayout 
       android:layout_width="0dp" 
       android:layout_height="match_parent" 
       android:layout_marginTop="10dp" 
       android:layout_weight="1" 
       android:background="@drawable/filebinder" /> 

      <LinearLayout 
       android:layout_width="0dp" 
       android:layout_height="match_parent" 
       android:layout_weight="14" 
       android:orientation="vertical"> 

       <LinearLayout 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_marginLeft="5dp" 
        android:layout_marginRight="10dp" 
        android:orientation="horizontal"> 


        <LinearLayout 
         android:layout_width="0dp" 
         android:layout_height="wrap_content" 
         android:layout_weight="6" 
         android:orientation="vertical"> 

         <TextView 
          android:id="@+id/dateDiary" 
          android:layout_width="match_parent" 
          android:layout_height="wrap_content" 
          android:layout_marginTop="10dp" 
          android:fontFamily="sans-serif" 
          android:text="30 July" 
          android:textColor="#03a9f4" 
          android:textSize="20sp" /> 

         <LinearLayout 
          android:layout_width="match_parent" 
          android:layout_height="1dp" 
          android:layout_marginBottom="10dp" 
          android:background="#03a9f4" /> 

        </LinearLayout> 

        <LinearLayout 
         android:layout_width="0dp" 
         android:layout_height="wrap_content" 
         android:layout_weight="1" 
         android:background="@drawable/diarybookmark" /> 

       </LinearLayout> 

       <ScrollView 
        android:id="@+id/scrollView" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_margin="10dp"> 

        <EditText 
         android:id="@+id/diaryHeading" 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:layout_gravity="center_horizontal" 
         android:layout_margin="10dp" 
         android:ems="5" 
         android:fontFamily="sans-serif" 
         android:hint="Diary Heading" 
         android:inputType="textPersonName" 
         android:textAlignment="center" 
         android:textColor="#000000" 
         android:textSize="18sp" /> 
       </ScrollView> 

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


        <EditText 
         android:id="@+id/diaryTeacherName" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:layout_alignParentBottom="true" 
         android:layout_gravity="center" 
         android:fontFamily="sans-serif" 
         android:hint="Teacher\'s Name..." 
         android:textSize="16sp" /> 


        <at.markushi.ui.CircleButton 
         android:id="@+id/addDiaryEntry" 
         android:layout_width="74dip" 
         android:layout_height="74dip" 
         android:layout_gravity="right" 
         android:src="@drawable/ic_action_tick" 
         app:cb_color="@color/actionbar_title_color" 
         app:cb_pressedRingWidth="8dip" 
         android:layout_alignParentBottom="true" 
         android:layout_alignParentRight="true" 
         android:layout_alignParentEnd="true" /> 

        <EditText 
         android:id="@+id/diaryContent" 
         android:layout_width="match_parent" 
         android:layout_height="match_parent" 
         android:layout_above="@+id/addDiaryEntry" 
         android:layout_alignLeft="@+id/scrollView" 
         android:layout_alignStart="@+id/scrollView" 
         android:layout_alignTop="@+id/scrollView" 
         android:fontFamily="sans-serif" 
         android:gravity="top" 
         android:hint="Enter Diary Note...\n\n\n\n" 
         android:text="Dear Parents," 
         android:textSize="14sp" /> 


       </RelativeLayout> 
      </LinearLayout> 
     </LinearLayout> 
    </android.support.v7.widget.CardView> 
</LinearLayout> 

여기가 코드 스크린 샷 여기

enter image description here enter image description here

하고 있습니다 내 매니페스트

<activity 
      android:name=".DiaryEntry.DiaryEntryTeacherActivity" 
      android:label="DiaryEntry" 
      android:windowSoftInputMode="adjustResize" 
      android:theme="@style/AppTheme.NoActionBar"></activity> 
+1

'CardView'의 하위보기를'ScrollView'로 추가하려고 했습니까? – Sanoop

+0

아니, 내가 그걸 시도해야한다고 생각해. .. – Shubh

답변

0

당신은 같은 ScrollView를 사용할 필요가;

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:card_view="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="@color/actionbar_title_color" 
    android:orientation="vertical"> 

    <include 
     android:id="@+id/include" 
     layout="@layout/toolbar" /> 

    <ScrollView 
     android:id="@+id/scroll_view" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:fillViewport="true"> 

     <android.support.v7.widget.CardView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginBottom="25dp" 
      android:layout_marginLeft="25dp" 
      android:layout_marginRight="25dp" 
      android:layout_marginTop="25dp" 
      card_view:cardElevation="10sp" 
      card_view:cardUseCompatPadding="true"> 

      <LinearLayout 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 

       android:background="#ffffff" 
       android:orientation="horizontal"> 

       <LinearLayout 
        android:layout_width="0dp" 
        android:layout_height="match_parent" 
        android:layout_marginTop="10dp" 
        android:layout_weight="1" 
        android:background="@drawable/filebinder" /> 

       <LinearLayout 
        android:layout_width="0dp" 
        android:layout_height="match_parent" 
        android:layout_weight="14" 
        android:orientation="vertical"> 

        <LinearLayout 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:layout_marginLeft="5dp" 
         android:layout_marginRight="10dp" 
         android:orientation="horizontal"> 


         <LinearLayout 
          android:layout_width="0dp" 
          android:layout_height="wrap_content" 
          android:layout_weight="6" 
          android:orientation="vertical"> 

          <TextView 
           android:id="@+id/dateDiary" 
           android:layout_width="match_parent" 
           android:layout_height="wrap_content" 
           android:layout_marginTop="10dp" 
           android:fontFamily="sans-serif" 
           android:text="30 July" 
           android:textColor="#03a9f4" 
           android:textSize="20sp" /> 

          <LinearLayout 
           android:layout_width="match_parent" 
           android:layout_height="1dp" 
           android:layout_marginBottom="10dp" 
           android:background="#03a9f4" /> 

         </LinearLayout> 

         <LinearLayout 
          android:layout_width="0dp" 
          android:layout_height="wrap_content" 
          android:layout_weight="1" 
          android:background="@drawable/diarybookmark" /> 

        </LinearLayout> 

        <ScrollView 
         android:id="@+id/scrollView" 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:layout_margin="10dp"> 

         <EditText 
          android:id="@+id/diaryHeading" 
          android:layout_width="match_parent" 
          android:layout_height="wrap_content" 
          android:layout_gravity="center_horizontal" 
          android:layout_margin="10dp" 
          android:ems="5" 
          android:fontFamily="sans-serif" 
          android:hint="Diary Heading" 
          android:inputType="textPersonName" 
          android:textAlignment="center" 
          android:textColor="#000000" 
          android:textSize="18sp" /> 
        </ScrollView> 

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


         <EditText 
          android:id="@+id/diaryTeacherName" 
          android:layout_width="wrap_content" 
          android:layout_height="wrap_content" 
          android:layout_alignParentBottom="true" 
          android:layout_gravity="center" 
          android:fontFamily="sans-serif" 
          android:hint="Teacher\'s Name..." 
          android:textSize="16sp" /> 


         <at.markushi.ui.CircleButton 
          android:id="@+id/addDiaryEntry" 
          android:layout_width="74dip" 
          android:layout_height="74dip" 
          android:layout_gravity="right" 
          android:src="@drawable/ic_action_tick" 
          app:cb_color="@color/actionbar_title_color" 
          app:cb_pressedRingWidth="8dip" 
          android:layout_alignParentBottom="true" 
          android:layout_alignParentRight="true" 
          android:layout_alignParentEnd="true" /> 

         <EditText 
          android:id="@+id/diaryContent" 
          android:layout_width="match_parent" 
          android:layout_height="match_parent" 
          android:layout_above="@+id/addDiaryEntry" 
          android:layout_alignLeft="@+id/scrollView" 
          android:layout_alignStart="@+id/scrollView" 
          android:layout_alignTop="@+id/scrollView" 
          android:fontFamily="sans-serif" 
          android:gravity="top" 
          android:hint="Enter Diary Note...\n\n\n\n" 
          android:text="Dear Parents," 
          android:textSize="14sp" /> 


        </RelativeLayout> 
       </LinearLayout> 
      </LinearLayout> 
     </android.support.v7.widget.CardView> 
    </ScrollView> 
</LinearLayout> 
관련 문제