新手的问题:你如何布局图标,2文本行和一个按钮? [英] Newbie question: How do you layout an icon, 2 text lines and a button?
问题描述
我试图延长样品,我发现在的http:// developer.android.com/resources/articles/layout-tricks-efficiency.html 。我是一个全新的MonoDroid的开发商,刚安装了它昨天,并试图直接进入UI设计,至今它不是完全点击我。
I am trying to extend a sample I found at http://developer.android.com/resources/articles/layout-tricks-efficiency.html. I am a brand new MonoDroid developer, just installed it yesterday, and trying to jump right into UI design and so far it is not clicking for me completely.
我有这样的main.xml:
I have this main.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="?android:attr/listPreferredItemHeight"
android:padding="6dip">
<ImageView
android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
android:layout_marginRight="6dip"
android:src="@drawable/icon" />
<TextView
android:id="@+id/secondLine"
android:layout_width="200dip"
android:layout_height="26dip"
android:layout_toRightOf="@id/icon"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:singleLine="true"
android:ellipsize="marquee"
android:text="Second line which is a long line of text and needs to scroll" />
<TextView
android:id="@+id/firstLine"
android:layout_width="200dip"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/icon"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_above="@id/secondLine"
android:layout_alignWithParentIfMissing="true"
android:singleLine="true"
android:ellipsize="marquee"
android:gravity="center_vertical"
android:text="First line" />
<Button
android:id="@+id/logonButton"
android:layout_width="50dip"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/secondLine"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:gravity="center_vertical"
android:text="Login" />
/>
</RelativeLayout>
我所试图做的是左边的图标,2行文字堆放在中间和右边的按钮。当我在模拟器中运行这个我看到:结果
What I am trying to do is have an icon on the left, 2 lines of text stacked in the middle and a button on the right. When I run this in my emulator I am seeing:
- 第二行是不滚动。
- 按钮不会显示出来。
是否有任何机会进行布局简单的所见即所得的编辑器?还是有一个应用程序给我我的布局XML的快速视图?像Firefox中的Firebug的东西就可以了。
Is there by any chance a simple WYSIWYG editor for layout? Or is there an app to give me a quick view of my layout XML? Something like FireBug in FireFox would be fine.
除非渺茫还有对Droid的用户界面帮手,我究竟做错了什么? :)
Barring the slim chance there are UI helpers for Droid, what am I doing wrong? :)
注意:我发现的 hierarchyviewer 的和按钮没有显示出来在所有(可见)尽管它在层次结构显示。 http://screencast.com/t/rdjaR0tCM6
NOTE: I found hierarchyviewer and the button is not showing up at all (visible) though it does show in the heirarchy. http://screencast.com/t/rdjaR0tCM6
推荐答案
我有相同的问题,如果有的话,我认为这是与他们在本教程中解释的方式有问题。我现在已经使用了不同的版本,但并不把文字之外的图标,只是它的下面。在这里看到: http://img263.imageshack.us/i/sellscreen.jpg/
I have the exact same problem, if anything i think it's a problem with the way they explain it in the tutorial. I have now used a different version but that does not put the text besides the icon, only underneath it. See here: http://img263.imageshack.us/i/sellscreen.jpg/
如果你们能帮得到并排文本一边,然后我将分享我的code供大家使用。我是pretty多少试图做一样的你。我需要5个图标向下左侧与除每个文本和文本之外的每一位的按钮。我真的与此挣扎。一直在努力了好几天。
If you guys can help get the text side by side then i will share my code for everyone to use. I'm pretty much trying to do the same as you. I need 5 icons down the left with text besides each and a button besides each bit of text. I'm really struggling with this. Been trying for days.
这篇关于新手的问题:你如何布局图标,2文本行和一个按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!