Issue
In Xamarin, how can I display two objects (TextViews in this case) vertically that refer to the same Resource.Id?
Here is my Layout file:
<?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>
Here is my C# code:
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";
The Web2 TextView is the only TextView that is being displayed.
Can I have some help please?
Thanks in advance
Solution
You can use "\n" between both texts. Like:
SetContentView (Resource.Layout.AutoLinkTextView);
TextView Web = (TextView)FindViewById(Resource.Id.TextViewAutoLink);
Web.Text = "Test address of http://www.google.com"+"\n"+"Test address of
http://www.stackoverflow.com";
Answered By - user543
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.