wsheji;
import android.os.Bundle;
import android.app.Activity;
t.Context;
t.Intent;
import android.view.Menu;
import android.view.View;
public class MainActivity extends Activity {
private Context context = MainActivity.this;
@Override
protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_main);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().u.main, menu);
return true;
}
public void changepicture(View v){
Intent intent = new Intent(context, newactivity.class);
startActivity(intent);
}
}
wsheji;
import android.app.Activity;
t.Context;
t.Intent;
import android.os.Bundle;
import android.view.View;
public class newactivity extends Activity {
private Context context = newactivity.this;
@Override
protected void onCreate(Bundle savedInstanceState) {
setContentView(wactivity);
}
public void changemessage(View v){
Intent intent = new Intent(context, MainActivity.class);
startActivity(intent);
}
}
<RelativeLayout
xmlns:android="schemas.android/apk/res/android"
xmlns:tools="schemas.android/tools"
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/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/textView1"
android:layout_alignParentTop="true"
android:layout_marginTop="132dp"
android:onClick="newfile"
android:text="@string/interview3"/>
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/textView3"
android layout布局
android:layout_below="@+id/textView3"
android:layout_marginTop="39dp"
android:text="@string/interview2"/>
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/textView3"
android:layout_alignParentLeft="true"
android:layout_marginBottom="49dp"
android:layout_marginLeft="76dp"
android:text="@string/interview1"/>
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/textView2"
android:layout_alignParentBottom="true"
android:layout_marginBottom="72dp"
android:onClick="changepicture"
android:text="切换图片"/>
</RelativeLayout>
<?xml version="1.0"encoding="utf-8"?>
<LinearLayout xmlns:android="schemas.android/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:id="@+id/imageView1"
android:layout_width="287dp"
android:layout_height="81dp"
android:layout_weight="0.14"
android:src="@drawable/hfhkdhf"/>
<Button
android:id="@+id/button1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="changemessage"
android:text="跳转到个人资料"/>
</LinearLayout>

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。