2017-10-13 84 views
0

我在android.The要求上设计工作是当我在一个s croll layout有超过10场按钮应该低于对齐的scroll view结束,如果我在布局中只有两个字段它应该对齐屏幕的底部静态。现在我面临的问题是如果我有少于3个字段我的Textview按钮来到顶部,如果没有滚动,它没有对齐在屏幕的底部。我附加我的XML这里请让我知道了一些建议如果启用滚动,如何在底部设置按钮?

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:id="@+id/signupRootLay" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:orientation="vertical" 
android:paddingTop="?android:attr/actionBarSize"> 

<ImageView 
    android:id="@+id/backgroundImage" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:scaleType="centerCrop" 
    android:src="@drawable/background" /> 

<RelativeLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="#b3000000"> 

    <LinearLayout 
     android:id="@+id/pageCountParentLay" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_centerHorizontal="true" 
     android:orientation="horizontal"> 

     <TextView 
      android:id="@+id/firstpageTextView" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:background="@drawable/circle_bg_with_low_contrast_color" 
      android:gravity="center" 
      android:text="@string/page_1" 
      android:textColor="@color/high_contrast_color" 
      android:textStyle="bold" /> 

     <TextView 
      android:id="@+id/secondPageTextView" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:background="@drawable/circle_bg_with_low_contrast_color" 
      android:gravity="center" 
      android:text="@string/page_2" 
      android:textColor="@color/high_contrast_color" 
      android:textStyle="bold" /> 

     <TextView 
      android:id="@+id/thirdPageTextView" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:background="@drawable/circle_bg_with_low_contrast_color" 
      android:gravity="center" 
      android:text="@string/page_3" 
      android:textColor="@color/high_contrast_color" 
      android:textStyle="bold" /> 

     <TextView 
      android:id="@+id/fourthPageTextView" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:background="@drawable/circle_bg_with_low_contrast_color" 
      android:gravity="center" 
      android:text="@string/page_4" 
      android:textColor="@color/high_contrast_color" 
      android:textStyle="bold" /> 
    </LinearLayout> 

    <LinearLayout 
     android:id="@+id/titleParentLay" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/pageCountParentLay" 
     android:orientation="horizontal"> 

     <View 
      android:id="@+id/leftLine" 
      android:layout_width="wrap_content" 
      android:layout_height="1dp" 
      android:layout_gravity="center" 
      android:layout_weight="1" 
      android:background="@color/secondary_color" /> 

     <TextView 
      android:id="@+id/pageTitleTextView" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:gravity="center" 
      android:text="@string/page_title_1" 
      android:textColor="@color/secondary_color" 
      android:textSize="18sp" /> 

     <View 
      android:id="@+id/rightLine" 
      android:layout_width="wrap_content" 
      android:layout_height="1dp" 
      android:layout_gravity="center" 
      android:layout_weight="1" 
      android:background="@color/secondary_color" /> 

    </LinearLayout> 

    <ScrollView 
     android:id="@+id/scroll" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 

     android:layout_below="@+id/titleParentLay"> 

     <LinearLayout 
      android:id="@+id/parentLay" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:orientation="vertical"> 

      <include layout="@layout/si_fields" /> 

      <include layout="@layout/si_exi_card_layout" /> 

      <include layout="@layout/password_layout" /> 
      <TextView 
       android:id="@+id/nextTextView" 
       android:layout_width="match_parent" 
       android:layout_height="45dp" 
       android:layout_alignParentBottom="true" 
       android:background="@drawable/button_low_contrast_color_bg" 
       android:gravity="center" 
       android:text="@string/next_label" 
       android:textColor="@color/high_contrast_color" 
       android:textSize="18sp" /> 
     </LinearLayout> 

    </ScrollView> 




</RelativeLayout> 

+0

尝试包滚动型与LinearLayout中和滚动视图后放YOUT按钮,我想你可以达到你想要的。如果你希望你的按钮在*屏幕的底部静态可见*尝试在相对布局 –

+0

谢谢你我会尝试@BerkayTutal –

+0

它不起作用 –

回答

0

尝试this..Add低于线ScrollView

<ScrollView 
     android:id="@+id/scroll" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:fillViewport="true"/> 
+0

最后两个包括布局都不见了,如果我申请这fillviewport和textview按钮不在滚动视图 –

+0

@MaheskumarSubramani请张贴您的图像如何你想要... –

0

只要把按钮滚动视图和多数民众赞成它外面。 例子是这样的:

<ScrollView> 
 
    <RelativeLayout> 
 
    </RelativeLayout> 
 
</ScrollView> 
 
<Button />

+0

我只需要按钮内的滚动,如果字段是更多的和滚动之外,如果领域较少,我的全部字段是动态的 –

相关问题