2013-10-11 52 views
0

我試圖用屏幕的底部來增加我的assist_update_btn,但它似乎沒有這樣做。出於某種原因,它坐在TextView下方,出於某種原因不與屏幕底部對齊。android:layout_alignParentBottom =「true」不能按預期運行。

任何輸入,非常感謝。

<?xml version="1.0" encoding="utf-8"?> 
<!-- LinearLayout allows border to expand to entire screen --> 
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:background="@drawable/background" 
android:orientation="vertical" > 
> 

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

      <TextView 
       android:id="@+id/apn_app_text_cta2" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:textSize="18sp" 
       android:layout_marginTop="30sp" 
       android:layout_marginLeft="30sp" 
       android:layout_marginRight="30sp" 
       android:textColor="#000000" 
       android:text="@string/apn_app_text_cta2"/> 


      <ImageView 
       android:id="@+id/assist_update_btn" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_below="@+id/apn_app_text_cta2" 
       android:layout_alignParentBottom="true" 
       android:layout_centerHorizontal="true" 
       android:src="@drawable/btn_next_inactivei" /> 

     </RelativeLayout> 

</ScrollView> 
+0

ü想你都在佈局的底部和ImageView的下面的TextView和ImageView的textview ??是你想要的? – Manishika

回答

0

這是因爲該行

android:layout_below="@+id/apn_app_text_cta2" 

刪除它,你應該得到預期的結果。這條線與將它與其父母的底部對齊相沖突。

+0

它仍然沒有對齊屏幕的底部 – HelloMojo

+0

它放置在文本上(並似乎與其底部對齊) – HelloMojo

+0

啊,我明白了。將這個答案和jansel的答案結合起來就可以工作。 – codeMagic

0

發生這種情況是因爲ScrollView不會將整個屏幕集合android:fillViewport="true"設置爲滾動視圖,而且還會從ImageView中刪除android:layout_below="@+id/apn_app_text_cta2"以實現此目的。

+0

我怎麼才能真正讓它出現在apn_app_text_cta2下面呢? – HelloMojo

+0

只需在ImageView中添加'android:fillViewport =「true」'到您的滾動視圖並從中刪除'android:layout_below =「@ + id/apn_app_text_cta2」'' – xhamr

1

ImageView

<!-- LinearLayout allows border to expand to entire screen --> 
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:fillViewport="true" 

> 


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

      <TextView 
       android:id="@+id/apn_app_text_cta2" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:textSize="18sp" 
       android:layout_marginTop="30sp" 
       android:layout_marginLeft="30sp" 
       android:layout_marginRight="30sp" 
       android:textColor="#000000" 
       android:text="@string/apn_app_text_cta2"/> 


      <ImageView 
       android:id="@+id/assist_update_btn" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_alignParentBottom="true" 
       android:layout_centerHorizontal="true" 
       android:src="@drawable/btn_next_inactivei"/> 

     </RelativeLayout> 

</ScrollView> 

嘗試下面的代碼在layout.Added android:fillViewport="true"ScrollView和 刪除android:layout_below="@+id/apn_app_text_cta2"這應該工作