2015-01-14 2 views
0

그래서 안드로이드 애플리케이션 페이지 중 하나에서 조각 페이지로 cardview를 사용하고 있습니다. 나는 cardview를 사용하여 깔끔한 정사각형 레이아웃을 얻었지만, 긴 텍스트의 경우 마지막 단락에 대해 1 행만큼 잘랐으며 layout_marginbottom도 작동하지 않는 것 같습니다. 무슨 일이야? Android 긴 텍스트가 텍스트보기를 잘라 냈습니다

내 fragmentpage.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" 
    android:orientation="vertical" 
    android:background="#ffffff" > 

     <android.support.v7.widget.CardView 
      xmlns:card_view="http://schemas.android.com/apk/res-auto" 
      android:id="@+id/card_view" 
      android:layout_margin="8dp" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:clickable="false" 
      android:foreground="?android:attr/selectableItemBackground" 
      card_view:cardCornerRadius="0dp"> 

      <ScrollView 
       android:layout_width="match_parent" 
       android:layout_height="match_parent"> 
       <LinearLayout android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:layout_marginTop="20dp" 
        android:layout_marginBottom="20dp" 
        android:orientation="vertical" 
        android:layout_marginLeft="10dp" 
        android:layout_marginRight="10dp"> 

        <ImageView 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:src="@drawable/ifgf_logo" /> 

        <TextView android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:layout_marginTop="20dp" 
         android:layout_gravity="center_horizontal|center" 
         android:gravity="center" 
         android:textSize="25sp" 
         android:layout_centerInParent="true" 
         android:textColor="#626262" 
         android:text="Title 1"/> 

        <TextView android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:layout_marginTop="20dp" 
         android:layout_gravity="center_horizontal|center" 
         android:gravity="center" 
         android:textSize="15sp" 
         android:layout_centerInParent="true" 
         android:textColor="#626262" 
         android:text="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum."/> 

        <TextView android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:layout_marginTop="20dp" 
         android:layout_gravity="center_horizontal|center" 
         android:gravity="center" 
         android:textSize="25sp" 
         android:layout_centerInParent="true" 
         android:textColor="#626262" 
         android:text="Title 2"/> 

        <TextView android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:layout_marginTop="20dp" 
         android:layout_gravity="center_horizontal|center" 
         android:gravity="center" 
         android:textSize="15sp" 
         android:layout_centerInParent="true" 
         android:textColor="#626262" 
         android:text="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum."/> 

        <TextView android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:layout_marginTop="20dp" 
         android:layout_gravity="center_horizontal|center" 
         android:gravity="center" 
         android:textSize="25sp" 
         android:layout_centerInParent="true" 
         android:textColor="#626262" 
         android:text="Title 3"/> 

        <TextView android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:layout_marginTop="20dp" 
         android:layout_gravity="center_horizontal|center" 
         android:gravity="center" 
         android:textSize="15sp" 
         android:layout_centerInParent="true" 
         android:textColor="#626262" 
         android:text="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum."/> 

        <TextView android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:layout_marginTop="20dp" 
         android:layout_gravity="center_horizontal|center" 
         android:gravity="center" 
         android:textSize="25sp" 
         android:layout_centerInParent="true" 
         android:textColor="#626262" 
         android:text="Title 4"/> 

        <TextView android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:layout_marginTop="20dp" 
         android:layout_gravity="center_horizontal|center" 
         android:gravity="center" 
         android:textSize="15sp" 
         android:layout_centerInParent="true" 
         android:textColor="#626262" 
         android:text="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum."/> 
       </LinearLayout> 
      </ScrollView> 
     </android.support.v7.widget.CardView> 
</RelativeLayout> 

이며, 이것은 내가 아래로 스크롤하기 전에 스크린 샷 이고, 나는 아래로 스크롤 한 후. 상단 부분은 마진 상단이 올바르게 있지만 하단 부분에는 여백이없는 것처럼 보이며 일부 텍스트도 잘립니다.

enter image description here enter image description here

+0

는 여전히 단락이 작동하지 않습니다 CardView' – kId

답변

0

이 같은 빈보기를 삽입 할 수 있습니다

<View 
     android:layout_width="fill_parent" 
     android:layout_height="20dp" /> 

을 // 당신의 필요 조건

장소 레이아웃에이 코드를 (시작시 모두에 따라 높이를 설정 및 끝)을 표시합니다.

과 같이 수행

<?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" 
    android:background="#ffffff" 
    android:orientation="vertical" 
    android:padding="30dp" > 

    <ScrollView 
     android:layout_width="fill_parent" 
     android:layout_height="match_parent" > 

     <LinearLayout 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      android:layout_marginBottom="20dp" 
      android:layout_marginLeft="10dp" 
      android:layout_marginRight="10dp" 
      android:layout_marginTop="20dp" 
      android:orientation="vertical" > 

      <View 
       android:layout_width="fill_parent" 
       android:layout_height="20dp" /> 

      <ImageView 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:src="@drawable/ic_launcher" /> 

      <TextView 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:layout_centerInParent="true" 
       android:layout_gravity="center_horizontal|center" 
       android:layout_marginTop="20dp" 
       android:gravity="center" 
       android:text="Title 1" 
       android:textColor="#626262" 
       android:textSize="25sp" /> 

      <TextView 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:layout_centerInParent="true" 
       android:layout_gravity="center_horizontal|center" 
       android:layout_marginTop="20dp" 
       android:gravity="center" 
       android:text="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry&apos;s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum." 
       android:textColor="#626262" 
       android:textSize="15sp" /> 

      <TextView 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:layout_centerInParent="true" 
       android:layout_gravity="center_horizontal|center" 
       android:layout_marginTop="20dp" 
       android:gravity="center" 
       android:text="Title 2" 
       android:textColor="#626262" 
       android:textSize="25sp" /> 

      <TextView 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:layout_centerInParent="true" 
       android:layout_gravity="center_horizontal|center" 
       android:layout_marginTop="20dp" 
       android:gravity="center" 
       android:text="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry&apos;s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum." 
       android:textColor="#626262" 
       android:textSize="15sp" /> 

      <TextView 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:layout_centerInParent="true" 
       android:layout_gravity="center_horizontal|center" 
       android:layout_marginTop="20dp" 
       android:gravity="center" 
       android:text="Title 3" 
       android:textColor="#626262" 
       android:textSize="25sp" /> 

      <TextView 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:layout_centerInParent="true" 
       android:layout_gravity="center_horizontal|center" 
       android:layout_marginTop="20dp" 
       android:gravity="center" 
       android:text="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry&apos;s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum." 
       android:textColor="#626262" 
       android:textSize="15sp" /> 

      <TextView 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:layout_centerInParent="true" 
       android:layout_gravity="center_horizontal|center" 
       android:layout_marginTop="20dp" 
       android:gravity="center" 
       android:text="Title 4" 
       android:textColor="#626262" 
       android:textSize="25sp" /> 

      <TextView 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:layout_centerInParent="true" 
       android:layout_gravity="center_horizontal|center" 
       android:layout_marginTop="20dp" 
       android:gravity="center" 
       android:text="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry&apos;s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum." 
       android:textColor="#626262" 
       android:textSize="15sp" /> 

      <View 
       android:layout_width="fill_parent" 
       android:layout_height="20dp" /> 
     </LinearLayout> 
    </ScrollView> 

</RelativeLayout> 

희망이 도움이 ... :)

+0

'의 하단에 약간의'padding' ..를 제공 할 수 있습니다 그림에서처럼 잘린 것처럼 보입니다. "Aldus pagemaker"가 다시 Lorem Ipsum까지 올 것이라고 가정합니다. – Harts

+0

글쎄, 내 장치에서 같은 코드를 시도했는데 정상적으로 작동합니다. 제 코드를 살펴보십시오. – Pihu

+0

나는 나의 대답을 편집했다 – Pihu

관련 문제