2017-04-06 6 views
0

私はどのようにテキストビューとボタンの一部をページの下部に置くか分かりません。私は重力底などを試みたが、それは仕事をしなかった。Android - DockのTextviewとボタンの下にあるボタン

<ScrollView 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" 
tools:context="com.example.tiagosilva.amob_android.HomeFragment" 
android:background="@color/AMOB_gray"> 

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

    <TextView 
     android:id="@+id/textView10" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:text="Company" 
     android:textColor="@android:color/white" 
     android:textSize="20sp" 
     android:textStyle="bold" /> 

    <TextView 
     android:id="@+id/textView11" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:paddingTop="10dp" 
     android:text="@string/welcomeAmobHome" 
     android:textColor="@android:color/white" 
     android:textSize="14sp" /> 


    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="Follow us on our Social Networks" 
     android:textSize="20dp" 
     android:textColor="@android:color/white" /> 

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

     <Button 
      android:id="@+id/btn_facebook" 
      android:layout_width="0dp" 
      android:layout_weight="1" 
      android:layout_height="54dp" 
      android:background="@drawable/facebook_icon" 
      android:layout_margin="10dp"/> 

     <Button 
      android:id="@+id/btn_twitter" 
      android:layout_width="0dp" 
      android:layout_weight="1" 
      android:layout_height="55dp" 
      android:background="@drawable/twitter_icon" 
      android:layout_margin="10dp"/> 

     <Button 
      android:id="@+id/btn_youtube" 
      android:layout_width="0dp" 
      android:layout_weight="1" 
      android:layout_height="50dp" 
      android:background="@drawable/instagram_icon" 
      android:layout_margin="10dp"/> 

     <Button 
      android:id="@+id/btn_instagram" 
      android:layout_width="0dp" 
      android:layout_weight="1" 
      android:layout_height="50dp" 
      android:background="@drawable/youtube_icon" 
      android:layout_margin="10dp"/> 

     <Button 
      android:id="@+id/btn_flickr" 
      android:layout_width="0dp" 
      android:layout_weight="1" 
      android:layout_height="49dp" 
      android:background="@drawable/flikr_icon" 
      android:layout_margin="10dp"/> 

    </LinearLayout> 

</LinearLayout> 

私はボタンと「私たちのソーシャルネットワーク上で私たちに従ってください」と言うのTextViewをドッキングします。

enter image description here

+0

、あなたを助けることができる –

+0

@AvishekDasが同意RelativeLayoutで試してみてください。 'android:layout_alignParentBottom'を使用してください。http://stackoverflow.com/questions/2386866/how-to-align-views-at-the-bottom-of-the-screen –

答えて

0

このような何かが

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:orientation="vertical" 
tools:context="com.example.tiagosilva.amob_android.HomeFragment" 
android:background="@color/AMOB_gray"> 

<ScrollView 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="@color/grey" 
    android:fillViewport="true"> 

    <RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:orientation="vertical" 
     android:padding="15dp"> 

     <TextView 
      android:id="@+id/textView10" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:text="Company" 
      android:textColor="@android:color/white" 
      android:textSize="20sp" 
      android:textStyle="bold"/> 

     <TextView 
      android:id="@+id/textView11" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:paddingTop="10dp" 
      android:text="@string/welcomeAmobHome" 
      android:textColor="@android:color/white" 
      android:textSize="14sp" 
      android:layout_below="@id/textView10"/> 


     <TextView 
      android:id="@+id/textView12" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="Follow us on our Social Networks" 
      android:textColor="@android:color/white" 
      android:textSize="20dp" 
      android:layout_below="@id/textView11"/> 

     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:orientation="horizontal" 
      android:weightSum="5" 
      android:layout_below="@id/textView12" 
      android:gravity="bottom" 
      android:layout_alignParentBottom="true"> 

      <Button 
       android:id="@+id/btn_facebook" 
       android:layout_width="0dp" 
       android:layout_height="54dp" 
       android:layout_margin="10dp" 
       android:layout_weight="1" 
       android:background="@drawable/facebook_icon"/> 

      <Button 
       android:id="@+id/btn_twitter" 
       android:layout_width="0dp" 
       android:layout_height="55dp" 
       android:layout_margin="10dp" 
       android:layout_weight="1" 
       android:background="@drawable/twitter_icon"/> 

      <Button 
       android:id="@+id/btn_youtube" 
       android:layout_width="0dp" 
       android:layout_height="50dp" 
       android:layout_margin="10dp" 
       android:layout_weight="1" 
       android:background="@drawable/instagram_icon"/> 

      <Button 
       android:id="@+id/btn_instagram" 
       android:layout_width="0dp" 
       android:layout_height="50dp" 
       android:layout_margin="10dp" 
       android:layout_weight="1" 
       android:background="@drawable/youtube_icon"/> 

      <Button 
       android:id="@+id/btn_flickr" 
       android:layout_width="0dp" 
       android:layout_height="49dp" 
       android:layout_margin="10dp" 
       android:layout_weight="1" 
       android:background="@drawable/flikr_icon"/> 

     </LinearLayout> 

    </RelativeLayout> 
</ScrollView> 

関連する問題