1. 程式人生 > >Android開發————簡易備忘錄

Android開發————簡易備忘錄

實驗內容

1. android 開發環境搭建, 開發工具可以是eclipse+adt 或android studio。

2. 按照實驗課要求製作對應的app小程式,實現按鈕新增備忘錄。

3. 編寫並提交實驗報告。

實驗步驟

(1)main_activity.xml程式碼:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:weightSum="1">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        >
        <TextView
            android:id="@+id/t1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="10dp"
            android:text="新增備忘錄內容:"
            />
        <EditText
            android:id="@+id/e"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            />
    </LinearLayout>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        >
        <Button
            android:id="@+id/b1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:onClick="Click"
            android:text="新增備忘錄"/>
    </LinearLayout>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        >

        <ListView
            android:id="@+id/l"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:divider="#000000"
            android:dividerHeight="0.5dp">

        </ListView>
    </LinearLayout>

</LinearLayout>

MainActivity程式碼:

package com.example.administer.beiwanglu;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.ListView;

import java.util.ArrayList;

public class MainActivity extends AppCompatActivity {
        public ArrayList list=new ArrayList();
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main_atcivity);

        }

        public void Click(View view){
            EditText text=(EditText)findViewById(R.id.e);
            String s=text.getText().toString();
            list.add(s);
            ListView listView=(ListView)findViewById(R.id.l);
            ArrayAdapter<String> ad =new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,list);
            listView.setAdapter(ad);
        }
    }

實驗結果

相關推薦

Android開發——簡易備忘錄(三)

實驗內容 1. android 開發環境搭建, 開發工具可以是eclipse+adt 或android studio。 2. 按照實驗課要求製作對應的app小程式,實現按鈕新增備忘,並且包含日期時間。 3. 編寫並提交實驗報告。 實驗步驟 1.部分程式碼如下:

Android開發————簡易備忘錄

實驗內容 1. android 開發環境搭建, 開發工具可以是eclipse+adt 或android studio。 2. 按照實驗課要求製作對應的app小程式,實現按鈕新增備忘錄。 3. 編寫並提交實驗報告。 實驗步驟 (1)main_activity.xml程

Android開發————簡易App設計

實驗內容 1.點陣圖預覽 2.點陣圖資料傳遞顯示 實驗步驟 活動1: Xml: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.

Android開發————簡易APP設計(二)

實驗內容 使用sqlite 給備忘錄app增加資料儲存功能 實驗步驟 活動1: Xml: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://sche

Android開發————3、簡易備忘錄(二)

實驗內容 1. android 開發環境搭建, 開發工具可以是eclipse+adt 或android studio。 2. 按照實驗課要求製作對應的app小程式,實現按鈕新增備忘,並且包含日期時間。 3. 編寫並提交實驗報告。 實驗步驟 實驗程式碼如下: <

受不了Android SDK文檔打開緩慢問題,自己開發簡易脫機瀏覽器。

write 瀏覽歷史 code int protected ppt 便在 1.0 bundle google android sdk離線文檔打開的時候特別慢,據說是要從谷歌官網拉取一些東西導致的。脫機瀏覽能夠解決該問題。PC端能夠使用firefox。 可是Android

簡易計算器學習Android開發

初學Android移動開發,先從一個簡單的專案開始——簡易計算器。 前言: 如果你在Android studio配置方面有什麼錯誤,可以參考我的其他部落格。這裡只是寫一下我作為一個初學者的開發筆記,總結自己的得失,為以後的開發打基礎。對你有幫助的地方請自取。 目錄 前言: 開

android開發筆記之網路程式設計—簡易新聞客戶端

今天我們來對前面講過的知識綜合運用一下,包括xml的PULL解析,listView的萬能介面卡等知識。。。。 那先來看一個元件—->智慧圖片載入器(smart-image-view),它可以很方便的載入一張網路圖片。 SmartImageView的設計

Android開發簡易路由框架

EasyRouter EasyRouter是專門針對Android開發的簡易路由框架,支援路由分組,使用方便,功能全面。主要包含三大模組功能:路由轉發、自動注入和路由攔截。 專案地址

Android 開發第七彈:簡易時鐘(秒錶)

佈局 同樣是新建一個類(StopWatchView)並擴充套件自LinearLayout,並將其用作佈局。 <myapplication.nomasp.com.clock.StopWatchView android : id = "@+

Android開發入門的正確姿勢,你get到了嗎?

開源 如何 com 正常 它的 接收 應用 切換 角度 在進行Android開發之前,我們先了解一下Android的生態圈現狀。Android系統是開源的,任何手機廠商和開發者都有權限去修改系統源代碼,定制專屬的系統。 這就產生了一個問題,不同手機廠商之間的ROM可能無法安

Android開發分享功能實現步驟

集成 sha har sse 分享 功能 秘鑰 步驟 過去 參考mob官網(http://www.mob.com/) 分享實現步驟:1.mob官網賬號註冊登錄2.進入後臺,進入ShareSDK,添加應用,生成秘鑰3.參照mob官網集成文檔,下載SDK,進入ShareSDK

值得推薦的android開發框架簡單介紹

ron 事件 能開 android 開發人員 服務端開發 kjpush 流量 htm 一些總結出來的Android高速開發框架,所有都是開源框架,附帶項目地址,是開發學習的絕佳資料。 Direct-Load-apk項目 項目主頁地址:http://www.kymjs

Android開發學習——簡單類圖

構造函數 大腦 聚合 函數 學習 contains 構造 入參 logs 1.類A繼承於類B (B 是父類,A是 子類) 2.小汽車、自行車 實現車的接口 3.A中有B這個成員變量,單向關聯 4.聚合,整體與部分的關系。has-a B中的構造函數(或set方法

Android開發中有用工具之--Log工具類

util lena 日誌 日誌信息 stat 們的 常常 我們 imp 在開發的過程中。我們常常會使用Log來輸出日誌,幫助我們來調試程序 可是有時候並不能全然滿足我們的須要 ,比方我想知道這個日誌信息是來自於哪一個包 哪一個類 所以我們封裝一個這個Log類。方便我們的

在Windows下搭建Android開發環境

c51 公司 智能 單獨 window 引用 ssp 管理 第一個  隨著移動互聯網的迅速發展,前端的概念已發生很大的變化,已不僅僅局限在網頁端。而Android系統作為智能機市場的老大,作為前端開發工程師,非常有必要了解和學習。但面對眾多學習資料,站在前端開發工程

Android開發-5】界面裝修,五大布局你選誰

比例 技術分享 article 嵌套 content java lin layout mark 前言:假設要開一家店,門店裝修是非常重要的事情。有錢都請專門的建築設計公司來設計裝修,沒錢的僅僅能自己瞎折騰。好不好看全憑自己的感覺。像Android開發。在移動端大家看到的

Android開發系列之SQLite

分組 ets ket where pla 情況 流行 database which 上篇博客提到過SQLite。它是嵌入式數據庫,因為其輕巧但功能強大,被廣泛的用於嵌入式設備其中。後來在智能手機、平板流行之後,它作為文件型數據庫,差點兒成為了智能設備單機數據庫的必選,能夠

Android開發之getX,getRawX,getWidth,getTranslationX等的區別

save string hlist getwidth sta 是我 touch 項目 寬度 轉載請註明出處:http://blog.csdn.net/dmk877/article/details/51550031 好久沒寫博客了,最近工作確實挺忙的,剛剛結束了一個

Android 開發之Windows環境下Android Studio安裝和使用教程(圖文詳細步驟)

9.png 虛擬機 jdk版本 編寫 clip 開發平臺 集成開發 arc 電腦安裝 鑒於谷歌最新推出的Android Studio備受開發者的推崇,所以也跟著體驗一下。 一、介紹Android Studio Android Studio 是一個Android