在android中底部设置textview
作者:互联网
我在Linearlayout里面有Textview.我希望它显示在底部,但它只显示在我的中心.我的xml文件看起来像下面的代码.我尝试用RelativeLayout替换LinearLayout但它没有用.
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@android:color/black">
<RelativeLayout
android:id="@+id/relativeLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#000"
android:layout_gravity="bottom" >
</RelativeLayout>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/TextViewBottomTitle"
android:text="@string/app_logo_bottom"
android:textColor="@color/logo_color"
android:gravity="center"
android:textSize="@dimen/logo_size"></TextView>
<TextView
android:id="@+id/TextViewBottomVersion"
android:text="@string/app_version_info"
android:textSize="@dimen/version_size"
android:textColor="@color/version_color"
android:background="@color/version_bkgrd"
android:layout_height="fill_parent"
android:lineSpacingExtra="@dimen/version_spacing"
android:layout_width="fill_parent"
android:layout_gravity="center_vertical|center_horizontal"
android:gravity="center"></TextView>
</LinearLayout>
有谁有想法?
解决方法:
这可以帮助你:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@android:color/black">
<RelativeLayout
android:id="@+id/relativeLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#000"
android:layout_gravity="bottom" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/TextViewBottomTitle"
android:text="@string/app_logo_bottom"
android:textColor="@color/logo_color"
android:gravity="bottom"
android:layout_alignParentBottom="true"
android:textSize="@dimen/logo_size"></TextView>
<TextView
android:id="@+id/TextViewBottomVersion"
android:text="@string/app_version_info"
android:textSize="@dimen/version_size"
android:textColor="@color/version_color"
android:background="@color/version_bkgrd"
android:layout_height="fill_parent"
android:lineSpacingExtra="@dimen/version_spacing"
android:layout_width="fill_parent"
android:layout_gravity="bottom"
android:layout_alignParentBottom="true"
android:gravity="bottom"></TextView>
</RelativeLayout>
</LinearLayout>
标签:android,android-layout,android-textview 来源: https://codeday.me/bug/20190728/1566503.html