对齐TextView底部的标签布局



我试图将TextView对齐到Tab Layout的底部,因此它与屏幕底部齐平。它基本上相当于浏览器状态栏,它只有几个像素高,里面有一些文本。这是我目前所看到的:

<LinearLayout
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:padding="0dp"
    <TabWidget
        android:id="@android:id/tabs"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" 
        android:padding="0dp"
        android:background="@drawable/tab_bg_selector" 
     />           
     <FrameLayout
        android:id="@android:id/tabcontent"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:padding="0dp" 
     />
        <TextView 
    android:id="@+id/status"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
    android:text="Last Updated"
    android:layout_alignParentBottom="true"
    android:background="#cccccc"
/>         
</LinearLayout>
 <RelativeLayout
    android:orientation="vertical"
    android:layout_width="fill_parent" 
    android:layout_height="10dp"
    android:layout_alignParentBottom="true">        
<TextView 
    android:id="@+id/status"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
    android:background="#cccccc"
    />
 </RelativeLayout>
</TabHost>

你已经设置了TextView的高度和宽度为"fill_parent"。这意味着视图本身的基础位于底部,但视图中的文本可能位于其布局的顶部。你应该设置高度为"wrap_content"。如果视图的高度与需要的高度相同,那么它应该出现在布局的底部。

最新更新