Android重力相对布局问题 [英] Android relative layout problem with gravity

查看:73
本文介绍了Android重力相对布局问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将id ="naslov"的textview放在中心?我也尝试过用layout_gravity ="center",但这也不起作用.

How can i put textview with id="naslov" to the center? I also tried with layout_gravity="center" but that doesn't work either.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">

<TextView   
    android:id="@+id/naslov"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textSize="20dip"
    android:text="Povzetek"
    android:gravity="center"/>
   <TextView   
    android:id="@+id/aha"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textSize="10dip"
    android:text="Vseh oddaj:"
       android:layout_below="@id/naslov"/>  
 </RelativeLayout> 

推荐答案

 android:layout_centerHorizontal="true"

这篇关于Android重力相对布局问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆