為Blog添加版權説明
最近更換了新的Hexo主題hexo-theme-hiker,覺得挺好看的。文章底部沒有版權説明,自己動手加上。 新建文件 copyright.ejs在themes\hiker\layout\_partial新建文件copyright.ejs 打開copyright.ejs,添加一下內容。 12345678910111213141516<div> <ul class="post-copyright"> <li class="post-copyright-author"> <strong><%= __('copyright.author') %> </strong><%= config.author%></a> </li> <li class="po ...
第一行代碼筆記-ListView
手機屏幕空間有限,能顯示的內容不多。可以藉助ListView來顯示更多的內容。ListView允許用户通過上下滑動來將屏幕外的數據滾動到屏幕內,同時屏幕內原有的數據滾動出屏幕,從而顯示更多的數據內容。 ListView的簡單用法修改activity_main.xml1234567891011<LinearLayout xmlns: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:orientation="vertical" tools:context=".MainActivity"> <ListView ...
第一行代碼筆記-創建自定義控件
自定義控件 - 引入布局常見控件和布局的繼承結構所有的控件都是直接或者間接繼承於 View所有的布局都是直接或者間接繼承於 ViewGroupView 是 Android 中最基本的一種 UI 控件,它可以在屏幕上繪製一塊矩形區域,並能響應這塊區域的各種事件。ViewGroup 是特殊的一種 View,是一個用於放置控件和布局的容器 以添加 iPhone 風格的標題欄為例:當多個活動界面都要使用這個標題欄時,我們可以通過引入布局的方式,這樣可以避免每個活動界面都要寫一遍同樣的標題代碼,減少代碼重複。 創建布局文件新建一個 title.xml 12345678910111213141516171819202122232425262728293031323334353637<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android: ...
第一行代碼筆記-四大Layout
LinerLayout 線性布局LinerLayout, 中文名為線性布局。這個布局會將它所包含的控件在線性方向上依次排列。 我們可以通過android:orientation屬性來指定排列方向。 vertical為垂直方向,horizontal為水平方向 123456789101112131415161718192021<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" > <Button android:layout_width="wrap_content" android:layout_height=& ...
Hexo和Next主題的相關設置(持續更新)
字數統計和閲讀時長(網站底部/文章内)效果如圖 文章内 網頁頂部 安裝插件1npm install hexo-symbols-count-time --save 修改 站點配置文件1234567symbols_count_time: #文章内是否顯示 symbols: true time: true # 網頁底部是否顯示 total_symbols: true total_time: true 修改 主題配置文件123456789101112# Post wordcount display settings# Dependencies: https://github.com/theme-next/hexo-symbols-count-timesymbols_count_time: separated_meta: true #文章中的顯示是否顯示文字(本文字數|閱讀時長) item_text_post: true #網頁底部的顯示是否顯示文字(站點總字數|站點閱讀時長) item_text_total: false # Average Word Length ...
第一行代碼筆記-bulid.gradle 解析
外層的bulid.gradle文件123456789101112131415161718buildscript { repositories { jcenter() // 一個代碼托管倉庫 } dependencies { classpath 'com.android.tools.build:gradle:2.3.0' // 聲明一個gradle插件 // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files }}allprojects { repositories { jcenter() }}task clean(type: Delete) { delete roo ...
第一行代碼筆記-Android Studio工程目錄結構介紹
Project模式下的項目結構 .gradle 和 .idea主要放置的都是Android studio自動生成的一些文件。 app項目的代碼資源等內容都在這個目錄 gradle包含gradle wrapper的配置文件 .gitignore用來將指定的目錄或文件排除在版本控制之外的 build.gradle這是項目全局的gradle構建腳本。 gradle.properties這個文件是全局的gradle的配置文件,在這裏配置的屬性將會影響到項目中所有的gradle編譯腳本。 gradlew 和 gradlew.bat這兩個文件是用來在令行介面中執行gradle 命令的,其中gradlew 是在linux和mac 系統中使用,而gradlew.bat是在windows系統中使用。 local.properties用來指定本機中的Android sdk路徑,通常內容都是自動生成,我們並不需要修改。 settings.gradle用於指定項目中所有引入的模塊。通常情況下模塊的引入都是自動完成的,需要我們手動去修改的這個文件的場景可能比較少。 .iml.iml文件是所有IntelliJ ...
第一行代碼筆記-工具日志log
Log.v()verbose 級別,用於打印那些最爲瑣碎的、意義最小的日志信息。級別最低的一種。 Log.d ()debug 級別,用於打印一些調試信息。 Log.i ()info 級別,用於打印一些比較重要的數據可以分析用戶行爲的數據。 Log.w ()warm 級別,用於打印一些警告信息,提示程序在這個地方可能會有潛在的風險,最好去修復一下。 Log.e ()error 級別,用於打印程序中的錯誤信息。