Enlace directo:https://www.youtube.com/watch?v=vqrpEo-3llY
Adicional:
activity_main.xml
AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/AbsoluteLayout1" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".MainActivity" TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_x="27dp" android:layout_y="29dp" android:text="Bienvenido" / Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_x="42dp" android:layout_y="94dp" android:onClick="HolaMundo" android:text="Aceptar" //AbsoluteLayout
MainActivity.java
package com.example.holamundo;import android.app.Activity;import android.os.Bundle;import android.view.Menu;import android.view.View;import android.widget.TextView;public class MainActivity extends Activity { private TextView tv1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); tv1 = (TextView)findViewById(R.id.textView1); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } public void HolaMundo(View v){ tv1.setText("HolaMundo!"); }}
No hay comentarios:
Publicar un comentario