Created
July 29, 2017 17:22
-
-
Save gavilanch/9c610096a4e68b7f14fd7ce10b67e83c to your computer and use it in GitHub Desktop.
NotiXamarin video 1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// En el Main Activity: | |
protected override void OnCreate(Bundle bundle) | |
{ | |
base.OnCreate(bundle); | |
// Set our view from the "main" layout resource | |
SetContentView (Resource.Layout.Main); | |
var newsTitle = FindViewById<TextView>(Resource.Id.newsTitle); | |
var newsBody = FindViewById<TextView>(Resource.Id.newsBody); | |
var newsImage = FindViewById<ImageView>(Resource.Id.newsImage); | |
newsTitle.Text = "Este es un título"; | |
newsBody.Text = "Xamarin es una compañía de software estadounidense, propiedad de Microsoft y con sede principal en San Francisco(California), fundada en mayo de 2011 por Nat Friedman y Miguel de Icaza(que iniciaron el Proyecto Mono)"; | |
var icon = GetDrawable(Resource.Drawable.Icon); | |
newsImage.SetImageDrawable(icon); | |
} | |
// En el Main.axml | |
<?xml version="1.0" encoding="utf-8"?> | |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:orientation="vertical" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent"> | |
<TextView | |
android:text="Large Text" | |
android:textAppearance="?android:attr/textAppearanceLarge" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:id="@+id/newsTitle" | |
android:layout_marginLeft="10dp" | |
android:textStyle="bold" /> | |
<ImageView | |
android:src="@android:drawable/ic_menu_gallery" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:layout_margin="5dp" | |
android:id="@+id/newsImage" /> | |
<TextView | |
android:text="Medium Text" | |
android:textAppearance="?android:attr/textAppearanceMedium" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:layout_marginLeft="10dp" | |
android:id="@+id/newsBody" /> | |
</LinearLayout> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment