Murn
Murn

Reputation: 13

Textview activity

So basically I want to display information about a hotel/restaurant/club/whatever. I created this layout XML file: .xml:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >
    <ImageView
        android:id="@+id/picture"
        android:layout_width="80dp"
        android:layout_height="80dp"
        android:contentDescription="@string/image"
        android:paddingLeft="10dp"
        android:paddingRight="10dp" />

    <TextView
        android:id="@+id/description"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/picture"
        android:paddingBottom="10dp"
        android:textColor="#000000"
        android:textSize="16sp"
        android:textSTyle="bold" />

    <TextView
        android:id="@+id/description_real"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/description"
        android:paddingLeft="10dp"
        android:textColor="#666666"
        android:textSize="14sp" />

     <TextView
        android:id="@+id/openingtimes"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/description_real"
        android:paddingBottom="10dp"
        android:textColor="#000000"
        android:textSize="16sp"
        android:textSTyle="bold" />

    <TextView
        android:id="@+id/openingtimes_real"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/openingtimes"
        android:paddingLeft="10dp"
        android:textColor="#666666"
        android:textSize="14sp" />
     <TextView
        android:id="@+id/prices"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/openingtimes_real"
        android:paddingBottom="10dp"
        android:textColor="#000000"
        android:textSize="16sp"
        android:textSTyle="bold" />

    <TextView
        android:id="@+id/prices_real"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/prices"
        android:paddingLeft="10dp"
        android:textColor="#666666"
        android:textSize="14sp" />
</RelativeLayout>

I don't want to recieve the text that has to be displayed from the internet, but want to define it in the activity itself. How do I create this activity so that I can show the text in the layout defined in the XML? (very simple, nothing has to be clickable, just text)

Upvotes: 0

Views: 469

Answers (1)

Anton Cherkashyn
Anton Cherkashyn

Reputation: 5859

Take a look at this "Building your First App" tutorial. It's very simple and straightforward. It has all the basics of creating a new activity, defining the layout and using resources, like strings. This should be enough to implement what you've described.

Upvotes: 1

Related Questions