Skip to content

Commit

Permalink
hzuapps#4 hzuapps#290 提交实验4代码文件
Browse files Browse the repository at this point in the history
  • Loading branch information
Ci-ing committed Mar 23, 2019
1 parent 0f41bc2 commit b9635a4
Show file tree
Hide file tree
Showing 7 changed files with 157 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package edu.hzuapps.androidlabs.soft1714080902339;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//savedInstanceState:已经保存的实例对象
//实例跟对象都是真正存在内存里的
/**
* CXY笔记
* 1.如果数据发生变化,状态就发生变化
* Data=State
* 2.intent帮我们做交互的
* 3.所有的交互都是发生在某一个控件上的(无论是图片还是文本)(例如可以通过按钮点击跳转到某张图片上)
*/
setContentView(R.layout.activity_main);
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,64 @@
package edu.hzuapps.androidlabs.soft1714080902339;

import android.content.Intent;
import android.net.Uri;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class SecondActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.second_activity);
Button button_0 = (Button) findViewById(R.id.button_0 );
Button button_1 = (Button) findViewById(R.id.button_1 );
Button button_2 = (Button) findViewById(R.id.button_2 );
Button button_3 = (Button) findViewById(R.id.button_3 );
Button button_4 = (Button) findViewById(R.id.button_4 );

button_0.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v){
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("http://down.sparke.cn/search/1/1?content=f5a5403271b04b2690960a170c37b7d3&here=1"));
startActivity(intent);
}
});
button_1.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v){
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("http://down.sparke.cn/search/1/1?content=30916acfac32458c9cfe7b5f8cd620bf&here=1"));
startActivity(intent);
}
});
button_2.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v){
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("http://down.sparke.cn/search/1/1?content=faa2abd9bb854fdcacb2676d97bfff96&here=1"));
startActivity(intent);
}
});
button_3.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v){
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("http://down.sparke.cn/search/1/1?content=937c633592974ff39184cc626d729f2f&here=1"));
startActivity(intent);
}
});
button_4.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v){
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("http://down.sparke.cn/search/1/1?content=4029a6c2f62d478188070f5ce579fcbe&here=1"));
startActivity(intent);
}
});

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ protected void onCreate(Bundle savedInstanceState) {
setSupportActionBar(toolbar);

Button button_1 = (Button) findViewById(R.id.button_1 );
/**
* CXY笔记
* 定义匿名类,不用大动干戈去创建一个类,只定义一个小方法来使用就好了
*/
button_1 .setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v){
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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=".MainActivity">
<!--
笔记
1.类内有成员变量、类变量(用static定义)两种
2.成员变量由对象去访问
3.类变量由类去访问
-->
<TextView
android:id="@+id/textview_01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableTop="@drawable/cet46"


app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />

</android.support.constraint.ConstraintLayout>
Original file line number Diff line number Diff line change
@@ -1,20 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".SecondActivity">
android:layout_height="match_parent">

<TextView
android:id="@+id/imageview_01"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|center"
android:drawableBottom="@drawable/okok"
tools:layout_editor_absoluteX="0dp"
tools:layout_editor_absoluteY="0dp" />
<Button
android:id="@+id/button_0"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#808080"
android:text="听力资料" />

<Button
android:id="@+id/button_1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="阅读理解" />

<Button
android:id="@+id/button_2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#808080"
android:text="翻译训练" />

<Button
android:id="@+id/button_3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="写作训练" />

<Button
android:id="@+id/button_4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#808080"
android:text="单词积累" />

</android.support.constraint.ConstraintLayout>

<TextView
android:id="@+id/imageview_01"
android:layout_width="408dp"
android:layout_height="181dp"
android:layout_marginTop="200dp"
android:layout_gravity="center_horizontal|center"
android:drawableBottom="@drawable/okok" />
</LinearLayout>
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,23 @@
<Button
android:id="@+id/button_1"
style="@style/Widget.AppCompat.Button.Small"
android:layout_width="220dip"
android:layout_height="55dip"
android:layout_gravity="center_horizontal|bottom"
android:text="联系我们,获取最新资料。" />
android:layout_marginTop="125dp"
android:background="#808080"
android:textColor="#daa520"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|top"

android:text="获取最新过级资料" />

<TextView
android:id="@+id/text_view"
android:layout_width="match_parent"
android:layout_height="180dp"
android:gravity="center"
android:text="如果你想准备四六级,请点击页面底端按钮获取资讯。"
android:textColor="#00ff00"
android:textSize="24sp" />
android:text="准备过级?点击下面按钮一起加入学习吧!"
android:textColor="#808080"
android:textSize="20sp" />

<TextView
android:id="@+id/imageview_01"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<resources>
<string name="app_name">Soft1714080902339</string>
<string name="app_name">最新过关资料</string>
<string name="title_activity_soft1714080902339">Soft1714080902339Activity星火英语</string>
<string name="action_settings">Settings</string>
</resources>

0 comments on commit b9635a4

Please sign in to comment.