<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ProfilePage"
android:background="@android:color/holo_orange_dark">
<!-- TODO: Update blank fragment layout -->
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="UserProfilePage"
android:textSize="35dp"
android:textStyle="bold" />
<TextView
android:id="@+id/textView59"
android:layout_width="416dp"
android:layout_height="56dp"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:background="#000000"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView10" />
<ImageButton
android:id="@+id/ib43"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/textView59"
android:layout_centerHorizontal="true"
android:background="#00000000"
android:src="@drawable/home" />
</RelativeLayout>
package com.example.sel12.akskmovie;
import android.content.Intent;
import android.media.Image;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageButton;
/**
* A simple {@link Fragment} subclass.
*/
public class ProfilePage extends Fragment {
public ProfilePage() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_profile_page, container, false);
ImageButton ib43;
ib43 = (ImageButton) view.findViewById(R.id.ib43);
ib43.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intentLoadNewActivity = new Intent(getActivity(), Home2.class);
startActivity(intentLoadNewActivity);
}
});
return view;
}
}
如果有人能给我提供解决方案,真的很感谢……长期在网上搜索解决方案,但没有可行的解决方案。