2013-10-11 51 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"这应该工作