的iOS到Android:如何显示一个TextView [英] iOS to Android: How to display a TextView
问题描述
我在iPhone开发的背景下,这可能是我的一些与Android,而我在开发非常新的困惑的原因。
I have a background in iPhone development, which may be a cause of some of my confusion with Android, which I am very new at developing.
我的问题是:如何创建两个 TextViews
,并在屏幕上指定的确切位置?例如,在iPhone上,我将创建一个UILabel,生成指定的标签的大小和位置的矩形框,然后这个矩形设置为的UILabel的框架属性。
My question is this: How to I create two TextViews
, and specify their exact location on screen? For example, on the iPhone, I would create a UILabel, generate a rectangular frame that specified the label's size and position, and then set this rectangle to the frame property of the UILabel.
如果你能帮助我理解相似之处目标C
和iOS的UILabel
,这将是最有帮助的
If you can help me understand the similarities with Objective C
and iOS' UILabel
, that would be most helpful.
推荐答案
在Eclipse中创建一个基本的Android项目。你会在你的项目中的main.xml布局文件。您可以通过按Ctrl + Shift + R和键控main.xml中在Eclipse中打开它。
Create a basic Android project in eclipse. You will be having a main.xml layout file in your project. You can open it in Eclipse using Ctrl+Shift+r and keying in main.xml
复制粘贴此在你的XML清除其内容之后。
copy paste this in your xml after clearing its content.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:id="@+id/textView1"
android:layout_width="fill_parent"
android:text="TextView One"
android:layout_height="fill_parent"
android:layout_weight="1"></TextView>
<TextView
android:id="@+id/textView2"
android:layout_width="fill_parent"
android:text="TextView Two"
android:layout_height="fill_parent"
android:layout_weight="1"></TextView>
</LinearLayout>
这篇关于的iOS到Android:如何显示一个TextView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!