我想在我的活动中在我的图像下方设置超链接。例如,当我单击超链接时,新活动应该打开
我的 Main.java 文件
>package com.a.test;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.text.method.LinkMovementMethod;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
public class Main extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
主要的.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/background"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center_vertical"
android:orientation="vertical" >
<ImageView
android:id="@+id/product"
android:layout_width="match_parent"
android:layout_height="192dp"
android:layout_gravity="top"
android:contentDescription="@string/test"
android:gravity="center"
android:scaleType="fitCenter"
android:src="@drawable/img9" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello" />
<TextView
android:id="@+id/textview2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" Brand Name: Dolce and Gabbana"
android:textColor="#000000" />
<TextView
android:id="@+id/textview1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:text=" Color: Light Green"
android:textColor="#000000" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text=" Product Name: Hand Bag"
android:textColor="#000000" />
<TextView
android:layout_width="310dp"
android:layout_height="wrap_content"
android:text=" Price: $599.89"
android:textColor="#000000" />
</LinearLayout>