Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
li763407418 committed Jun 1, 2018
1 parent 9dbf1c5 commit a1ef132
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 3 deletions.
Binary file added soft1614080902325/#6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion soft1614080902325/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="edu.hzuapps.androidlabs.soft1614080902325">


<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
Expand Down
34 changes: 34 additions & 0 deletions soft1614080902325/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 27
defaultConfig {
applicationId "edu.hzuapps.androidlabs.soft1614080902325"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
google()
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.github.bumptech.glide:glide:4.7.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.7.1'

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@
import com.bumptech.glide.request.target.ImageViewTargetFactory;

public class personalInformationActivity extends AppCompatActivity {

private ImageView tv_11;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_personal_information);

tv_11=findViewById(R.id.tv_11);
Glide.with(this).load("http://p8.qhmsg.com/dr/217_214_/t01fe2c1732a6a9a83d.jpg").into((ImageView) tv_11);
}


Expand Down
47 changes: 47 additions & 0 deletions soft1614080902325/report6.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# 第六次实验

## 1.实验目标
掌握Android网络访问方法;
理解XML和JSON表示数据的方法。

###实验内容
我用在实现网络访问加载图片的方法是利用Android图片加载图Glide来实现访问网络图片的,没有按照老师说的实验内容做,如果不允许请告诉我重做
## 2. 实验步骤
1、在GitHub上面搜索Glide,里面有详细说明用法。
利用Android studio的gradle的功能帮我们加载库,方法是:
在bulid.gradle里面添加如下代码:

repositories {
mavenCentral()
google()
}

implementation 'com.github.bumptech.glide:glide:4.7.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.7.1'
完成之后在右上角点sync now更新。
2、此时利用之前activity_personal_information.xml写的一个ImageView

<ImageView
android:id="@+id/tv_11"
android:layout_width="match_parent"
android:layout_height="250dp"
/>
在personalInformationActivity.java上先声明ImageView tv_11,然后用Glide实现访问网络上的惠州学院图标。

private ImageView tv_11;

tv_11=findViewById(R.id.tv_11);
Glide.with(this).load("http://p8.qhmsg.com/dr/217_214_/t01fe2c1732a6a9a83d.jpg").into((ImageView) tv_11);
3、最后最重要的是要得到网络授权。
在AndroidManifest.xml上加入代码:

<uses-permission android:name="android.permission.INTERNET"/>
## 3. 实验结果

![在Android SDK](https://github.com/li763407418/android-labs-2018/blob/master/soft1614080902325/%236.png)


## 4. 实验体会
我做的是利用Imageview来实现访问网络上的图片,跟老师的要求有点不太一样,老师要求是下载保存到本地然后将图片显示在应用上,而我的是不下载直接显示。

**加粗**常规

0 comments on commit a1ef132

Please sign in to comment.