机器人全屏用户界面与scretched中心

问题描述:

是否有可能使用固定标题20 dp,固定页脚15 dp和中心应该被拉伸到所有屏幕高度-35dp的android上的相对或线性布局? 应该是这样的:机器人全屏用户界面与scretched中心

是。你可以使用这个s.a.的许多布局。 RelativeLayout,LinearLayout或ConstraintLayout。我建议使用RelativeLayout,在其中您将页眉和页脚的视图设置为固定。下面是如何在XML做到这一点的例子:

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <TextView 
     android:id="@+id/tv_top" 
     android:background="@android:color/holo_orange_light" 
     android:layout_alignParentTop="true" 
     android:layout_width="match_parent" 
     android:layout_height="20dp" /> 

    <TextView 
     android:id="@+id/tv_bottom" 
     android:background="@android:color/holo_red_light" 
     android:layout_alignParentBottom="true" 
     android:layout_width="match_parent" 
     android:layout_height="15dp" /> 

    <LinearLayout 
     android:layout_below="@id/tv_top" 
     android:layout_above="@id/tv_bottom" 
     android:orientation="vertical" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content"/> 

</RelativeLayout> 

,这是它怎么会看在设备上:

enter image description here

+0

谢谢,Serj!优秀的解决 – osolodkin