2017-01-29 27 views
2

你可以看到下面的代碼屬於佈局設計。我已經爲Android設計的底部Listview並沒有完全顯示

<LinearLayout 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:orientation="vertical" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:padding="5dp"> 

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

     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:orientation="vertical"> 

      <LinearLayout 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:orientation="horizontal"> 

       <ImageView 
         android:id="@+id/profilePic2" 
         android:layout_width="@dimen/feed_item_profile_pic" 
         android:layout_height="@dimen/feed_item_profile_pic" 
         android:scaleType="fitCenter" > 
        </ImageView> 

       <LinearLayout 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:orientation="vertical" 
        android:paddingLeft="@dimen/feed_item_profile_info_padd" > 

        <TextView 
         android:id="@+id/name2" 
         android:layout_width="fill_parent" 
         android:layout_height="wrap_content" 
         android:textSize="@dimen/feed_item_profile_name" 
         android:textStyle="bold" /> 

        <TextView 
         android:id="@+id/timestamp2" 
         android:layout_width="fill_parent" 
         android:layout_height="wrap_content" 
         android:textColor="@color/timestamp" 
         android:textSize="@dimen/feed_item_timestamp" /> 

        <TextView 
         android:text="TextView" 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:id="@+id/textCategory2" 
         android:layout_weight="1" 
         android:textStyle="normal|bold"/> 

       </LinearLayout> 

      </LinearLayout> 

      <LinearLayout 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:orientation="vertical"> 


       <TextView 
        android:id="@+id/content2" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:paddingBottom="5dp" 
        android:paddingLeft="@dimen/feed_item_status_pad_left_right" 
        android:paddingRight="@dimen/feed_item_status_pad_left_right" 
        android:paddingTop="@dimen/feed_item_status_pad_top" 
        android:layout_weight="1"/> 

       <ImageView 
        android:id="@+id/contentImage2" 
        android:layout_width="match_parent" 
        android:background="@color/white" 
        android:scaleType="fitCenter" 
        android:visibility="visible" 
        android:cropToPadding="false" 
        android:layout_height="wrap_content" 
        android:adjustViewBounds="true" 
        app:srcCompat="@drawable/bg_parent_rounded_corner" 
        android:layout_weight="1"/> 

       <LinearLayout 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:orientation="vertical" 
        android:isScrollContainer="false" 
        android:keepScreenOn="false" 
        android:measureWithLargestChild="false" 
        android:verticalScrollbarPosition="defaultPosition" 
        android:paddingBottom="10dp"> 

        <TextView 
         android:text="@string/yorumlar" 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:id="@+id/textView" 
         android:layout_weight="1"/> 

        <ListView 
         android:layout_width="match_parent" 
         android:id="@+id/comList" 
         android:layout_height="wrap_content" 
         android:layout_centerHorizontal="false" 
         android:clipChildren="false" 
         android:headerDividersEnabled="false" 
         /> 
       </LinearLayout> 

      </LinearLayout> 

     </LinearLayout> 
    </ScrollView> 

</LinearLayout> 

我們可以看到顯示在屏幕頂部的職位的詳情,評論是在屏幕的底部。評論並沒有完全顯示,儘管scrollview包括列表視圖,我有「layout_height:wrap_content」。顯示的第一條評論,但不顯示與滾動。

感謝您的答案

Screenshot

回答

0

你必須改變下面的東西來顯示列表:

  1. 變化根線佈局從包裝內容高度匹配父。

    android:layout_height="match_parent" 
    
  2. 做同樣的事情滾動視圖

    android:layout_height="match_parent" 
    

3改變現在的ListView的高度,我已經給機器人:layout_height = 「500dp」 這一點。您可以根據您的要求進行調整。

注:列表視圖不會不給靜態的高度內滾動視圖工作。所以你必須給高度爲400..500dp或者你可以移除滾動視圖。

+0

謝謝你,我會嘗試這種解決方案 –

+0

歡迎易卜拉欣Ürüker:) – yogi

+0

感謝歡迎的瑜伽師:) –