相对布局问题/android
我在创建菜单时遇到问题(不是单击菜单按钮时的菜单,而是欢迎屏幕中选择项目的菜单)。我去了 ImageView 和 TextView float (left/right) Android 并我没有解决我的问题。我想创建至少五个或六个选项以从此菜单类中进行选择。这是我的 menu.xml 文件。请让我知道我需要做什么。
问题是第一个项目出现,但第二个项目与第一个项目重叠。我在过去一个小时里一直在解决这个问题,但无法解决这个问题。
<?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="5dp">
<TextView
android:textSize="18dp"
android:id="@+id/message_view"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text=" Check Your Account" />
<ImageView
android:src="@drawable/ic_menu_add"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/icon" />
<TextView
android:textSize="18dp"
android:id="@+id/message_view"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text=" View our Site" />
<ImageView
android:src="@drawable/ic_menu_add"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</RelativeLayout>
谢谢你。
I am having issues with creating a menu (not menu when you click menu button -- but menu as in the welcome screen to select items). I went to ImageView and TextView float (left/right) Android and I did not solve my issue. I would like to create at least five or six options to select from on this menu class. This is my menu.xml file. Please let me know what I need to do.
The issue is that the first item appears, but the second item overlaps the first item. I been picking away with this for the last hour and cannot solve this issue.
<?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="5dp">
<TextView
android:textSize="18dp"
android:id="@+id/message_view"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text=" Check Your Account" />
<ImageView
android:src="@drawable/ic_menu_add"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/icon" />
<TextView
android:textSize="18dp"
android:id="@+id/message_view"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text=" View our Site" />
<ImageView
android:src="@drawable/ic_menu_add"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</RelativeLayout>
thannk you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
为什么不使用
LinearLayout
(就像一个垂直布局,里面有几个水平的小布局,每个布局都有一个TextView
和一个ImageView
)?无论如何,如果你想使用
RelativeLayout
你应该使用android:layout_toRightOf
,android:layout_toLeftOf
,android:layout_above
code> 或android:layout_below
在 xml 中放置元素。我建议您查看 http://developer.android.com /reference/android/widget/RelativeLayout.LayoutParams.html 如果您不知道这些参数。
Why don't you use a
LinearLayout
(like a vertical one with severals little horizontal ones inside, each with aTextView
and anImageView
) ?Anyway, if you want to use
RelativeLayout
you should use something likeandroid:layout_toRightOf
,android:layout_toLeftOf
,android:layout_above
orandroid:layout_below
in your xml to place your elements.I advise you to take a look at http://developer.android.com/reference/android/widget/RelativeLayout.LayoutParams.html if you don't know those parameters.
您使用
RelativeLayout
,但不放置相互引用的元素。示例:
http://developer.android.com/reference/android/widget/RelativeLayout .html
You use a
RelativeLayout
but you don't place elements with reference to each other.Example :
http://developer.android.com/reference/android/widget/RelativeLayout.html
线性布局会更好。
尝试一下并告诉我这是否是您所需要的:
A Linear Layout would be better.
Try this and tell me if this is what you needed: