2016-01-08 36 views
3

我有一個活動,即使我沒有應用底部填充,也會在底部顯示額外空間。樣式代碼,XML代碼,Java代碼和截圖低於和有關JSON數據是在這裏:Android:填充0dp時底部顯示額外空間的活動 - 與json相關?

http://lara.rufflecol.es/strollcharlton/strollcharlton_data_1_2.json

這是不是一個巨大的問題,這只是煩人!已經嘗試使用android:fillViewport設置爲true或false,但它似乎沒有任何區別。問題與我的JSON有關嗎?

UsefulLinks.xml

<LinearLayout 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:orientation="vertical" 
    tools:context=""> 

<android.support.v7.widget.Toolbar 
    android:id="@+id/toolbar" 
    android:layout_width="match_parent" 
    android:layout_height="?actionBarSize" 
    android:background="@color/dark_green" 
    android:minHeight="?attr/actionBarSize" /> 

    <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_below="@id/toolbar" 
     android:orientation="vertical"> 

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

     <TextView 
      android:id="@+id/useful_links" 
      style="@style/UsefulLinksTextStyling" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_gravity="left" /> 

     </LinearLayout> 

    </ScrollView> 

</LinearLayout> 

styles.xml

<style name="UsefulLinksTextStyling" parent="@android:style/TextAppearance.Medium"> 
    <item name="android:textColor">@color/white</item> 
    <item name="android:textSize">@dimen/fifteen_size</item> 
    <item name="android:paddingTop">15dp</item> 
    <item name="android:paddingLeft">15dp</item> 
    <item name="android:paddingRight">15dp</item> 
</style> 

UsefulLinks.java

TextView usefulLinksIntroTextView = (TextView) findViewById(R.id.useful_links); 
usefulLinksIntroTextView.setText(Html.fromHtml(data.getUsefulLinks()));  
usefulLinksIntroTextView.setMovementMethod(LinkMovementMethod.getInstance()); 

Screenshot

+1

嘗試改變滾動型高度匹配父母 – Mahalakshmi

+0

沒有什麼不同,但是謝謝 –

+0

嘗試使用uiautomatorview工具,它是lo在sdk/tools /文件夾中。它可能會讓你知道填充是哪個項目的一部分 – Jahnold

回答

1

確保您設置搜索的HTML克至TextView的不讓它

改變你的基地LinearLayoutwrap_content內空白,這樣如果HTML佔用不到屏幕高度,你不必「微胖」

你也可以打開「顯示佈局界限」爲您的應用程序,這樣,你就會明白其中的觀點是給你的「微胖」 http://tysmith.me/post/27035355999/layoutbounds與層次瀏覽器http://developer.android.com/tools/performance/hierarchy-viewer/index.html結合起來制定出的圖,是有過錯

相關問題