日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > Android >内容正文

Android

2018-2019-2-20175225 实验四《Android开发基础》实验报告

發(fā)布時間:2023/12/10 Android 21 豆豆
生活随笔 收集整理的這篇文章主要介紹了 2018-2019-2-20175225 实验四《Android开发基础》实验报告 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

一、實驗報告封面

課程:Java程序設計 班級:1752班 姓名:張元瑞 學號:20175225

指導教師:婁嘉鵬 實驗日期:2019年5月14日

實驗時間:13:45 - 21:00 實驗序號:實驗四

實驗名稱:Android開發(fā)基礎

實驗內容:

1、Android Studio
2、相關工具

實驗要求:
1、完成實驗、撰寫實驗報告,實驗報告以博客方式發(fā)表在博客園,注意實驗報告重點是運行結果,遇到的問題(工具查找,安裝,使用,程序的編輯,調試,運行等)、解決辦法(空洞的方法如“查網絡”、“問同學”、“看書”等一律得0分)以及分析(從中可以得到什么啟示,有什么收獲,教訓等)。

2、嚴禁抄襲,有該行為者實驗成績歸零,并附加其他懲罰措施。

3.參考Android開發(fā)簡易教程

4.完成云班課中的檢查點,也可以先完成實驗報告,直接提交。注意不能只有截圖,要有知識點,原理,遇到的問題和解決過程等說明。實驗報告中一個檢查點要有多張截圖。

5.發(fā)表實驗報告博客,標題“學期(如2018-2019-2) 學號(如20175300) 實驗四《Android開發(fā)基礎》實驗報告”

二、實驗內容

1.Android程序設計-1

Android Stuidio的安裝測試: 參考《Java和Android開發(fā)學習指南(第二版)(EPUBIT,Java for Android 2nd)》第二十四章:

  • 參考http://www.cnblogs.com/rocedu/p/6371315.html#SECANDROID,安裝 Android Stuidio
  • 完成Hello World, 要求修改res目錄中的內容,Hello World后要顯示自己的學號,自己學號前后一名同學的學號,提交代碼運行截圖和碼云Git鏈接,截圖沒有學號要扣分
  • 學習Android Stuidio調試應用程序

    2.Android程序設計-2

    Activity測試: 參考《Java和Android開發(fā)學習指南(第二版)(EPUBIT,Java for Android 2nd)》第二十五章:

  • 構建項目,運行教材相關代碼
  • 創(chuàng)建 ThirdActivity, 在ThirdActivity中顯示自己的學號,修改代碼讓MainActivity啟動ThirdActivity
  • 提交代碼運行截圖和碼云Git鏈接,截圖要有學號水印,否則會扣分

    3.Android程序設計-3

    UI測試: 參考《Java和Android開發(fā)學習指南(第二版)(EPUBIT,Java for Android 2nd)》第二十六章:

  • 構建項目,運行教材相關代碼
  • 修改代碼讓Toast消息中顯示自己的學號信息
  • 提交代碼運行截圖和碼云Git鏈接,截圖要有學號水印,否則會扣分

    4.Android程序設計-4

    布局測試: 參考《Java和Android開發(fā)學習指南(第二版)(EPUBIT,Java for Android 2nd)》第二十七章:

  • 構建項目,運行教材相關代碼
  • 修改布局讓P290頁的界面與教材不同
  • 提交代碼運行截圖和碼云Git鏈接,截圖要有學號水印,否則會扣分

    5.Android程序設計-5

    事件處理測試: 參考《Java和Android開發(fā)學習指南(第二版)(EPUBIT,Java for Android 2nd)》第二十八章:

  • 構建項目,運行教材相關代碼
  • 提交代碼運行截圖和碼云Git鏈接,截圖要有學號水印,否則會扣分

二.實驗步驟

1.Android Stuidio的安裝測試

1.參考http://www.cnblogs.com/rocedu/p/6371315.html#SECANDROID,安裝 Android Stuidio
2.安裝完成運行后顯示缺少SDK,需要下載。
3.點擊下載后需要配置HTTP代理,此步驟一直重復,故在網上搜索后解決問題。(https://blog.csdn.net/u010164190/article/details/53168905)
4.在根據(jù)教程設置后可以下載,完成安裝SDK

6.修改activity_main.xml的代碼實現(xiàn)要求:

<?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"><TextViewandroid:id="@+id/textView"android:layout_width="wrap_content"android:layout_height="15dp"android:text="Hello World 20175224 20175225 20175226 !"app:layout_constraintBottom_toBottomOf="parent"app:layout_constraintLeft_toLeftOf="parent"app:layout_constraintRight_toRightOf="parent"app:layout_constraintTop_toTopOf="parent" /></android.support.constraint.ConstraintLayout>

7.編譯運行app

2.Activity測試

1.新建ThirdActivity ,點擊file->New->Activity->點empty activity建立ThirdActivity
按照要求在activity_third.xml中修改text信息

<?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=".ThirdActivity"><TextViewandroid:layout_width="144dp"android:layout_height="26dp"android:text="20175225張元瑞"tools:ignore="MissingConstraints"tools:layout_editor_absoluteX="109dp"tools:layout_editor_absoluteY="242dp" /> </android.support.constraint.ConstraintLayout>

2.進到MainActivity.java中修改代碼為:

package com.example.helloworld;import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.MotionEvent; import android.view.View;public class MainActivity extends AppCompatActivity {@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);Intent intent = new Intent(this,ThirdActivity.class);startActivity(intent);}}

3.運行結果

3.UI測試

1.在MainActivity.java中修改代碼:

package com.example.helloworld;import android.content.Context; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.app.Activity; import android.util.AttributeSet; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.Toast;public class MainActivity extends AppCompatActivity {@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);Button btnshow1 = (Button) findViewById(R.id.btn1);btnshow1.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View v) {Toast toast = Toast.makeText(MainActivity.this, "20175225張元瑞", Toast.LENGTH_LONG);toast.show();}});} }

2.運行結果

4.布局測試

1.在activity_third.xml中點擊design,切換到布局設計模式。
2.根據(jù)右側工具欄,可以調整字體顏色,背景顏色,圖片等等功能。
3.調整后發(fā)現(xiàn)txt中的代碼發(fā)生改變。

<RelativeLayoutxmlns:android="http://schemas.android.com/apk/res/android"xmlns:tools="http://schemas.android.com/tools"android:layout_width="match_parent"android:layout_height="match_parent"android:paddingLeft="2dp"android:paddingRight="2dp"><Buttonandroid:id="@+id/cancelButton"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_alignParentTop="true"android:layout_centerHorizontal="true"android:layout_marginTop="89dp"android:text="20175217" /><Buttonandroid:id="@+id/saveButton"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="張元瑞"android:layout_below="@+id/cancelButton"android:layout_alignLeft="@+id/cancelButton"android:layout_alignStart="@+id/cancelButton"android:layout_marginTop="23dp" /><ImageViewandroid:layout_width="150dp"android:layout_height="150dp"android:layout_marginTop="45dp"android:padding="4dp"android:src="@android:drawable/ic_btn_speak_now"tools:srcCompat="@tools:sample/avatars[8]" /><LinearLayoutandroid:id="@+id/filter_button_container"android:layout_width="match_parent"android:layout_height="wrap_content"android:layout_alignParentBottom="true"android:gravity="center|bottom"android:background="@android:color/white"android:orientation="horizontal" ><Buttonandroid:id="@+id/filterButton"android:layout_width="wrap_content"android:layout_height="fill_parent"android:text="Filter" /><Buttonandroid:id="@+id/shareButton"android:layout_width="wrap_content"android:layout_height="fill_parent"android:text="Share" /><Buttonandroid:id="@+id/deleteButton"android:layout_width="wrap_content"android:layout_height="fill_parent"android:text="Delete" /></LinearLayout> </RelativeLayout>

5.事件處理測試

1.根據(jù)要求修改MainActivity.java中的代碼

package com.example.myapplication;import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.app.Activity; import android.graphics.Color; import android.os.Bundle; import android.view.Menu; import android.view.View; import android.widget.AnalogClock; import android.app.Activity; import android.graphics.Color; import android.os.Bundle; import android.view.Menu; import android.view.View; import android.widget.AnalogClock; public class MainActivity extends Activity {int counter = 0;int[] colors = { Color.BLACK, Color.BLUE, Color.CYAN,Color.DKGRAY, Color.GRAY, Color.GREEN, Color.LTGRAY,Color.MAGENTA, Color.RED, Color.WHITE, Color.YELLOW };@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);}public void changeColor(View view) {if (counter == colors.length) {counter = 0;}view.setBackgroundColor(colors[counter++]);} }

2.修改activity_main.xml中代碼

<?xml version="1.0" encoding="utf-8"?><RelativeLayoutxmlns:android="http://schemas.android.com/apk/res/android"xmlns:tools="http://schemas.android.com/tools"android:layout_width="match_parent"android:layout_height="match_parent"tools:context=".MainActivity"><AnalogClockandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_alignParentTop="true"android:layout_centerHorizontal="true"android:layout_marginTop="90dp"android:id="@+id/analogClock1"android:onClick="changeColor" /><TextViewandroid:layout_width="match_parent"android:layout_height="match_parent"android:text="20175217wyf"android:layout_marginLeft="70dp"android:layout_marginTop="300dp"android:textSize="38dp"android:textColor="#bbbb00"/> </RelativeLayout>

3.運行結果

三.在實驗中遇到的問題

問題1:代碼有的地方是紅色的,而且不能編譯。

解決方案:在創(chuàng)建項目的時候路徑放錯了,又重新創(chuàng)建了一個新的項目放在了指定路徑以后就可以了。

問題2:虛擬機可以啟動,但是編譯的時候始終找不到虛擬機。

解決方案:上網搜索說是少了一個adb文件,沒辦法,只有全部重新下一遍Andorid,重新下一遍就好了。

四.實驗體會

  • 本次實驗所接觸的是全新的內容,感覺非常神奇,電腦上也可以用手機,在實驗的過程中也遇到了很多問題,在詢問同學和上網查找后解決了,自己應該學習的東西還很多,還要繼續(xù)努力。

轉載于:https://www.cnblogs.com/zhangdeshuai/p/10889053.html

總結

以上是生活随笔為你收集整理的2018-2019-2-20175225 实验四《Android开发基础》实验报告的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。