【发布时间】:2014-02-07 16:43:35
【问题描述】:
在 Xamarin 中,如何垂直显示两个对象(在本例中为 TextViews)引用相同的 Resource.Id?
这是我的布局文件:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:id="@+id/TextViewAutoLink"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:autoLink="all">
</TextView>
</LinearLayout>
这是我的 C# 代码:
SetContentView (Resource.Layout.AutoLinkTextView);
TextView Web = (TextView)FindViewById(Resource.Id.TextViewAutoLink);
Web.Text = "Test address of http://www.google.com";
TextView Web2 = (TextView)FindViewById(Resource.Id.TextViewAutoLink);
Web2.Text = "Test address of http://www.stackoverflow.com";
Web2 TextView 是唯一正在显示的 TextView。
我可以帮忙吗?
提前致谢
【问题讨论】:
-
为什么不在布局中添加另一个
TextView?
标签: android layout textview xamarin android-resources