Im muy nuevo en este desarrollo de Android. Acabo de comenzar a crear una aplicación de hello world.Cómo establecer una imagen de fondo en android
Intenté establecer una imagen de fondo y está funcionando bien. Cuando intenté agregar un texto en la imagen, no funcionaba.
Intenté en la forma a continuación. ¿Alguien puede por favor ayudarme donde estoy yendo mal.
en
Main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="@drawable/andriod"
android:layout_gravity="center_vertical"
android:gravity="center_vertical">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello" />
</LinearLayout>
HelloActivity.java
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
//import android.widget.ImageView;
public class HelloActivity extends Activity {
// /** Called when the activity is first created. */
// @Override
// public void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// setContentView(R.layout.main);
// }
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView tv = new TextView(this);
tv.setText("This is the first andorid app");
setContentView(R.layout.main);
}
}
Cuando se ejecuta está mostrando la imagen de fondo, pero "Esta es la primera aplicación Andorid" no se muestra.
Esperando por su ayuda
@ishhhh: Está configurando texto en TextView TV, pero no agrega este televisor en el diseño. – Mudassir