android學習筆記,android學習資料
故事是這樣的,因公司目前一個移動體征檢測產品需要連網。部門只有一個移動開發小夥,其他都是C#開發人員。客戶是爺啊!正當我無人可用、一籌莫展的時候,這小夥竟然叫我這個安卓新手給他搬磚。沒辦法,我這老傢伙也硬著頭皮上了。小夥帶著我這個拖油瓶一路走來,寫一點自己項目中的認知
1、android studio中添加圖片名稱是不能有大寫字元,否則編譯報錯
2、以XML方式書寫TabLayout時,代碼如下。需要注意的地方如
<TabHost android:id="@+id/main_tabHost" android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical"> <!-- TabWidget的id屬性必須為 @android:id/tabs --> <TabWidget android:id="@android:id/tabs" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="0" android:orientation="horizontal" /> <!-- FrameLayout的id屬性必須為 @android:id/tabcontent --> <FrameLayout android:id="@android:id/tabcontent" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="0" > <ImageView android:id="@+id/tab1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:src="@drawable/sample" /> <ImageView android:id="@+id/tab2" android:layout_width="wrap_content" android:layout_height="fill_parent" android:src="@drawable/new_patient" /> <ImageView android:id="@+id/tab3" android:layout_width="wrap_content" android:layout_height="fill_parent" android:src="@drawable/cases" /> <ImageView android:id="@+id/tab4" android:layout_width="wrap_content" android:layout_height="fill_parent" android:src="@drawable/config1" /> </FrameLayout> </LinearLayout> </TabHost>
未完繼續.........