二、Android Studio使用——導入jar包,運行、debug都不是問題


【新建AndroidStudio工程,lib導入jar

  我們的項目代碼都在app里面,可以看作是一個Model

  src 下面除了我們的代碼之外,還有單元測試。

把JAR復制到libs文件中。

 

【Genymotion模擬器插件的安裝、運行

AndroidStudio安裝Genymotion步驟:

1) 從官方下載插件:https://www.genymotion.com/

2AS中打開:

http://www.loverobots.cn/the-method-of-association-genymotion-in-studio-android.html

 【rundebuy,打印變量

第一個圖標:打上斷點,點直接調試,但這樣運行太慢。

第二個圖標:一般開發中直接運行,然后在調試的地方打上斷點后,點擊

【module的概念,添加library module

       

把代碼粘貼進來后,這個Module就新建好了。

關聯Module 步驟:在app右鍵打開,選擇Open Module Settings

現在就可以用了,在布局文件activity_main.xml中加入:

 1 <?xml version="1.0" encoding="utf-8"?>
 2 <com.firstdemo.stickyscroll.StickyScrollView  3     xmlns:android="http://schemas.android.com/apk/res/android"
 4  android:layout_width="match_parent"
 5  android:layout_height="match_parent"
 6  android:overScrollMode="never"
 7  android:fadingEdge="none"
 8  android:fillViewport="true">
 9 
10     <LinearLayout 11         android:layout_width="match_parent"
12  android:layout_height="wrap_content"
13  android:orientation="vertical">
14         <View 15             android:layout_width="match_parent"
16  android:layout_height="100dp"
17  android:background="@color/font_red2"/>
18         <View 19             android:tag="sticky"
20  android:layout_width="match_parent"
21  android:layout_height="200dp"
22  android:background="@color/home02"/>
23         <View 24             android:layout_width="match_parent"
25  android:layout_height="300dp"
26  android:background="@color/font_qingse"/>
27         <View 28             android:layout_width="match_parent"
29  android:layout_height="300dp"
30  android:background="@color/font_green2"/>
31         <View 32             android:layout_width="match_parent"
33  android:layout_height="300dp"
34  android:background="@color/home02"/>
35 
36     </LinearLayout>
37 </com.firstdemo.stickyscroll.StickyScrollView>

android:tag="sticky" 當控件設置該屬性的時候,混動到這個布局,就會懸停。

 下一個知識點,我們如何管理Module 

比如:我們不想要這個Module了,應該如何刪除呢:

app右鍵打開,選擇Open Module Settings打開。

這步,只是在配置中刪除了。接着,

 最后一步,點擊右鍵,然后刪除,就OK了。

 

 DEMO下載地址:http://download.csdn.net/detail/androidsj/9490788


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM