2013-04-28 120 views
0

我刚刚开始android编程。面对一个错误。 问题在于按钮覆盖了textview中的文本。 我试图把android:orientation =“vertical”.........但是这个android:方向不存在于xml中......我的意思是它没有在所提示的方法中显示..... ....请帮我热解决问题。按钮重叠textview

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:paddingBottom="@dimen/activity_vertical_margin" 
android:paddingLeft="@dimen/activity_horizontal_margin" 
android:paddingRight="@dimen/activity_horizontal_margin" 
android:paddingTop="@dimen/activity_vertical_margin" 
tools:context=".StartingPoint" > 

<TextView 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="@string/hello_world" 
    android:textSize="45sp" 
    android:gravity="center" 
    /> 

<Button 
    android:layout_width="250dp" 
    android:layout_height="wrap_content" 
    android:text="Add one" /> 

回答

0

这是因为您使用的是相对布局并没有什么特定的按钮相对。我会建议改为不同的布局(即线性布局)。这里有一个很好的教程:http://developer.android.com/guide/topics/ui/declaring-layout.html

+0

但为什么XML不显示android:方向? – amit 2013-04-28 20:19:24

+0

@NutterzUK .....对不起,我不明白你的答案.........我明白了.....非常感谢.... :) – amit 2013-04-28 20:26:47