Android DrawerLayout側(cè)邊導(dǎo)航欄的實(shí)現(xiàn)步驟
簡(jiǎn)介
DrawerLayout是Android開(kāi)發(fā)中一種常見(jiàn)的布局組件,常用于實(shí)現(xiàn)側(cè)滑菜單效果,它允許一個(gè)或多個(gè)子視圖在用戶交互時(shí)從屏幕邊緣滑出。
實(shí)現(xiàn)步驟
1.完成布局文件,以DrawerLayout為根布局,其第一個(gè)子布局為主布局,第二個(gè)子布局為側(cè)邊導(dǎo)航欄的布局。
DrawerLayout最多只能有兩個(gè)直接子View
注意:
側(cè)邊導(dǎo)航欄的布局必須設(shè)置屬性android:layout_gravity,側(cè)邊欄才不會(huì)顯示,否則側(cè)邊導(dǎo)航欄會(huì)默認(rèn)直接顯示在頁(yè)面。
android:layout_gravity="start" //側(cè)邊導(dǎo)航欄從左邊出現(xiàn) android:layout_gravity="end" //側(cè)邊導(dǎo)航欄從右邊出現(xiàn)
<?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.widget.DrawerLayout 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:id="@+id/main"
android:layout_height="match_parent"
android:background="@android:color/transparent"
android:fitsSystemWindows="true"
tools:context=".all.view.MainActivity">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/mainpage_viewpager2"
android:fitsSystemWindows="true"
android:layout_marginTop="30dp"
android:layout_width="match_parent"
android:layout_height="0dp">
<androidx.viewpager2.widget.ViewPager2
android:background="@android:color/transparent"
android:fitsSystemWindows="true"
android:id="@+id/main_viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
/>
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottom_navigation"
android:layout_width="match_parent"
android:layout_height="55dp"
android:elevation="1dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:menu="@menu/main_nav_bottom_menu"
android:background="@drawable/bottom_nav_view"
app:labelVisibilityMode="labeled"
app:itemBackground="@drawable/bottom_nav_view"
app:itemTextColor="@color/main_item_text_selector"
app:itemActiveIndicatorStyle="@null"
style="@style/CustomBottomNavigationView"
app:itemRippleColor="@color/white"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
>
</com.google.android.material.bottomnavigation.BottomNavigationView>
<ImageView
android:id="@+id/bottom_navigation_add"
android:layout_width="48dp"
android:layout_height="60dp"
android:src="@drawable/add"
android:elevation="200dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="310dp"
android:layout_height="match_parent"
android:background="#F5F5F5"
android:layout_gravity="start"
>
<ScrollView
android:id="@+id/drawerlayout_scroolview"
android:layout_width="match_parent"
android:layout_height="650dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_marginTop="65dp"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
app:cardCornerRadius="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
app:cardElevation="0dp"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="55dp"
android:orientation="horizontal"
>
<ImageView
android:layout_gravity="center_vertical"
android:src="@drawable/addfirends"
android:layout_marginLeft="15dp"
android:layout_width="28dp"
android:layout_height="28dp"/>
<TextView
android:layout_gravity="center_vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="添加好友"
android:textSize="14dp"/>
</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
app:cardCornerRadius="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
app:cardElevation="0dp"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="55dp"
android:orientation="horizontal"
>
<ImageView
android:layout_gravity="center_vertical"
android:src="@drawable/creators_center"
android:layout_marginLeft="15dp"
android:layout_width="28dp"
android:layout_height="28dp"/>
<TextView
android:layout_gravity="center_vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="創(chuàng)作者中心"
android:textSize="14dp"/>
</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
app:cardCornerRadius="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
app:cardElevation="0dp"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="55dp"
android:orientation="horizontal"
>
<ImageView
android:layout_gravity="center_vertical"
android:src="@drawable/my_draft"
android:layout_marginLeft="15dp"
android:layout_width="25dp"
android:layout_height="25dp"/>
<TextView
android:layout_gravity="center_vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="我的草稿"
android:textSize="14dp"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="55dp"
android:orientation="horizontal"
>
<ImageView
android:layout_gravity="center_vertical"
android:src="@drawable/my_comment"
android:layout_marginLeft="15dp"
android:layout_width="28dp"
android:layout_height="28dp"/>
<TextView
android:layout_gravity="center_vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="我的評(píng)論"
android:textSize="14dp"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="55dp"
android:orientation="horizontal"
>
<ImageView
android:layout_gravity="center_vertical"
android:src="@drawable/browse_records"
android:layout_marginLeft="15dp"
android:layout_width="28dp"
android:layout_height="28dp"/>
<TextView
android:layout_gravity="center_vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="瀏覽記錄"
android:textSize="14dp"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="55dp"
android:orientation="horizontal"
>
<ImageView
android:layout_gravity="center_vertical"
android:src="@drawable/my_download"
android:layout_marginLeft="21dp"
android:layout_width="20dp"
android:layout_height="20dp"/>
<TextView
android:layout_gravity="center_vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="我的下載"
android:textSize="14dp"/>
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
app:cardCornerRadius="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
app:cardElevation="0dp"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="55dp"
android:orientation="horizontal"
>
<ImageView
android:layout_gravity="center_vertical"
android:src="@drawable/orders"
android:layout_marginLeft="15dp"
android:layout_width="25dp"
android:layout_height="25dp"/>
<TextView
android:layout_gravity="center_vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="訂單"
android:textSize="14dp"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="55dp"
android:orientation="horizontal"
>
<ImageView
android:layout_gravity="center_vertical"
android:src="@drawable/shopping_cart"
android:layout_marginLeft="15dp"
android:layout_width="28dp"
android:layout_height="28dp"/>
<TextView
android:layout_gravity="center_vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="購(gòu)物車(chē)"
android:textSize="14dp"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="55dp"
android:orientation="horizontal"
>
<ImageView
android:layout_gravity="center_vertical"
android:src="@drawable/wallet"
android:layout_marginLeft="15dp"
android:layout_width="28dp"
android:layout_height="28dp"/>
<TextView
android:layout_gravity="center_vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="錢(qián)包"
android:textSize="14dp"/>
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
app:cardCornerRadius="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
app:cardElevation="0dp"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="55dp"
android:orientation="horizontal"
>
<ImageView
android:layout_gravity="center_vertical"
android:src="@drawable/small_routine"
android:layout_marginLeft="15dp"
android:layout_width="28dp"
android:layout_height="28dp"/>
<TextView
android:layout_gravity="center_vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="小程序"
android:textSize="14dp"/>
</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
app:cardCornerRadius="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
app:cardElevation="0dp"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="55dp"
android:orientation="horizontal"
>
<ImageView
android:layout_gravity="center_vertical"
android:src="@drawable/community_pact"
android:layout_marginLeft="15dp"
android:layout_width="28dp"
android:layout_height="28dp"/>
<TextView
android:layout_gravity="center_vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="社區(qū)公約"
android:textSize="14dp"/>
</LinearLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>
</ScrollView>
<LinearLayout
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/drawerlayout_scroolview"
android:layout_marginTop="30dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_marginLeft="30dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<FrameLayout
android:layout_gravity="center_horizontal"
android:layout_width="40dp"
android:layout_height="40dp"
android:background="@drawable/drawerlayout_background">
<ImageView
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:layout_width="20dp"
android:layout_height="20dp"
android:src="@drawable/sweep"/>
</FrameLayout>
<TextView
android:layout_gravity="center_horizontal"
android:layout_marginTop="5dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="掃一掃"
android:textSize="12dp"/>
</LinearLayout>
<LinearLayout
android:layout_marginLeft="50dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<FrameLayout
android:layout_gravity="center_horizontal"
android:layout_width="40dp"
android:layout_height="40dp"
android:background="@drawable/drawerlayout_background">
<ImageView
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:layout_width="20dp"
android:layout_height="20dp"
android:src="@drawable/customer_service"/>
</FrameLayout>
<TextView
android:layout_gravity="center_horizontal"
android:layout_marginTop="5dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="幫助與客服"
android:textSize="12dp"/>
</LinearLayout>
<LinearLayout
android:layout_marginLeft="50dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<FrameLayout
android:layout_gravity="center_horizontal"
android:layout_width="40dp"
android:layout_height="40dp"
android:background="@drawable/drawerlayout_background">
<ImageView
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:layout_width="20dp"
android:layout_height="20dp"
android:src="@drawable/set"/>
</FrameLayout>
<TextView
android:layout_gravity="center_horizontal"
android:layout_marginTop="5dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="設(shè)置"
android:textSize="12dp"/>
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.drawerlayout.widget.DrawerLayout>2.代碼控制
首先獲取DrawerLayout對(duì)象
drawerLayout=findViewById(R.id.main);
關(guān)閉側(cè)邊導(dǎo)航欄
drawerLayout.closeDrawers();
打開(kāi)側(cè)邊導(dǎo)航欄
drawerLayout.openDrawer(left); //上面的left既可以是菜單欄的布局對(duì)象,也可以是菜單欄的布局id
監(jiān)聽(tīng)側(cè)邊導(dǎo)航欄
drawerLayout.setDrawerListener(new DrawerLayout.DrawerListener() {
@Override
public void onDrawerSlide(View view, float v) {
}
@Override
public void onDrawerOpened(View view) {
Toast.makeText(MyActivity.this, "打開(kāi)了側(cè)邊欄" , Toast.LENGTH_LONG).show();
}
@Override
public void onDrawerClosed(View view) {
Toast.makeText(MyActivity.this, "關(guān)閉了側(cè)邊欄" , Toast.LENGTH_LONG).show();
}
@Override
public void onDrawerStateChanged(int i) {
}
});NavigationView
NavigationView 是 Android 支持庫(kù)中提供的一個(gè)專(zhuān)門(mén)用于配合 DrawerLayout 實(shí)現(xiàn)側(cè)邊導(dǎo)航菜單的控件。它本質(zhì)上是一個(gè)可滾動(dòng)的菜單容器,通常放在 DrawerLayout 的“抽屜”部分,用于顯示應(yīng)用的導(dǎo)航條目。
主要作用:
- 顯示菜單項(xiàng):通過(guò)menu屬性引用XML文件(menu.xml),自動(dòng)生成可點(diǎn)擊的的導(dǎo)航項(xiàng);
- 添加頭部視圖:通過(guò)app:headerLayout屬性添加用戶頭像、昵稱(chēng)、背景等內(nèi)容;
- 支持狀態(tài)高亮、點(diǎn)擊事件:點(diǎn)擊某個(gè)菜單項(xiàng)自動(dòng)高亮,可配合NavigationItemSelectedListener頁(yè)面跳轉(zhuǎn)。
1.實(shí)現(xiàn)布局文件
<com.google.android.material.navigation.NavigationView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:id = "@+id/nav_view"
android:layout_gravity="start"
app:headerLayout="@layout/nax_drawer_header"
app:menu = "@menu/nav_drawer_menu">
</com.google.android.material.navigation.NavigationView>
app:menu:引用一個(gè)菜單 XML 文件,定義導(dǎo)航項(xiàng)
app:headerLayout:引用一個(gè)布局 XML 文件,作為導(dǎo)航頭部
android:layout_gravity="start":指定抽屜從哪邊滑出,通常是 start 表示左側(cè),end代表右側(cè);
itemIconTint, itemTextColor:設(shè)置菜單圖標(biāo)和文字的顏色2.定義菜單
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/it_title"
android:title="更改頭像"
/>
<item
android:id="@+id/it_name"
android:title="修改昵稱(chēng)"
/>
<item
android:id="@+id/it_chatperson"
android:title="在線人數(shù)"
/>
<item
android:id="@+id/it_gotochat"
android:title="去聊天"
/>
<item
android:id="@+id/it_exit"
android:title="退出"
/>
</menu>3.導(dǎo)航頭部
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="300dp"
android:orientation="vertical">
<ImageView
android:layout_width="70dp"
android:layout_height="70dp"
android:src = "@drawable/title1"
android:layout_marginTop="100dp"
android:layout_gravity="center"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id = "@+id/tv_title"
android:layout_marginTop="20dp"
android:layout_gravity="center"
android:text="個(gè)人中心"/>
</LinearLayout>4.設(shè)置菜單項(xiàng)點(diǎn)擊事件
通過(guò)設(shè)置菜單項(xiàng)的點(diǎn)擊事件監(jiān)聽(tīng)器setNavigationItemSelectedListener()
navigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
int id = menuItem.getItemId();
if(id == R.id.it_chatperson){
Toast.makeText(MainActivity.this,"chatperson",Toast.LENGTH_SHORT).show();
}
else if(id == R.id.it_exit){
Toast.makeText(MainActivity.this,"exit",Toast.LENGTH_SHORT).show();
}
else if(id == R.id.it_gotochat){
Toast.makeText(MainActivity.this,"gotochat",Toast.LENGTH_SHORT).show();
}
else if(id == R.id.it_name){
Toast.makeText(MainActivity.this,"name",Toast.LENGTH_SHORT).show();
}
else if(id == R.id.it_title){
Toast.makeText(MainActivity.this,"title",Toast.LENGTH_SHORT).show();
}
return true;
}
});DrawerLayout的功能和特點(diǎn)
1. 側(cè)滑菜單功能:DrawerLayout 提供側(cè)邊滑出菜單的實(shí)現(xiàn),允許用戶通過(guò)滑動(dòng)屏幕邊緣或點(diǎn)擊按鈕打開(kāi)抽屜菜單,提升界面簡(jiǎn)潔性和可用性;
2. 支持左右兩側(cè)菜單:支持從屏幕的左側(cè)或右側(cè)分別展示抽屜菜單。通過(guò) layout_gravity="start"(左側(cè))和 layout_gravity="end"(右側(cè))來(lái)指定;
3. 與 Toolbar 集成:可以與 Toolbar 和 ActionBarDrawerToggle 配合使用,在 Toolbar 上顯示圖標(biāo),通過(guò)點(diǎn)擊圖標(biāo)打開(kāi)或關(guān)閉抽屜;
4. 內(nèi)建動(dòng)畫(huà)效果:DrawerLayout 自動(dòng)提供抽屜打開(kāi)和關(guān)閉的動(dòng)畫(huà)效果。主內(nèi)容視圖可以根據(jù)抽屜的滑動(dòng)進(jìn)行遮擋或平移,增強(qiáng)用戶體驗(yàn);
5. 支持監(jiān)聽(tīng)抽屜事件:提供 DrawerListener,可以監(jiān)聽(tīng)抽屜的打開(kāi)、關(guān)閉、滑動(dòng)、狀態(tài)變化等事件,方便開(kāi)發(fā)者根據(jù)抽屜狀態(tài)執(zhí)行相關(guān)操作。
6. 適配不同屏幕大?。篋rawerLayout 可以自動(dòng)適配小屏和大屏設(shè)備,適用于手機(jī)和平板等不同尺寸的屏幕,支持響應(yīng)式布局。
7. 結(jié)合 NavigationView 使用:常與 NavigationView 配合使用,后者提供了方便的菜單項(xiàng)管理、頭部布局和選中狀態(tài)功能,適合構(gòu)建標(biāo)準(zhǔn)的側(cè)邊導(dǎo)航菜單。
我們來(lái)講講代碼,在代碼中通過(guò)講解它的屬性,布局等來(lái)學(xué)習(xí):
<?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.widget.DrawerLayout
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:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="match_parent"
>
<androidx.appcompat.widget.Toolbar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id = "@+id/toolbar"
app:subtitle="子標(biāo)題"
app:title="標(biāo)題"
app:navigationIcon="@drawable/title"
>
</androidx.appcompat.widget.Toolbar>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
android:layout_gravity="center"
android:layout_marginTop="300dp"/>
</LinearLayout>
<com.google.android.material.navigation.NavigationView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:id = "@+id/nav_view"
android:layout_gravity="start"
app:headerLayout="@layout/nax_drawer_header"
app:menu = "@menu/nav_drawer_menu">
</com.google.android.material.navigation.NavigationView>
</androidx.drawerlayout.widget.DrawerLayout>到此這篇關(guān)于Android DrawerLayout實(shí)現(xiàn)側(cè)邊導(dǎo)航欄的詳細(xì)步驟的文章就介紹到這了,更多相關(guān)Android DrawerLayout側(cè)邊導(dǎo)航欄內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
Android編程之退出整個(gè)應(yīng)用程序的方法
這篇文章主要介紹了Android編程之退出整個(gè)應(yīng)用程序的方法,實(shí)例分析了Android直接關(guān)閉所有的Acitivity并退出應(yīng)用程序的實(shí)現(xiàn)技巧,需要的朋友可以參考下2015-12-12
25個(gè)實(shí)用酷炫的Android開(kāi)源UI框架
本文為大家分享了25個(gè)實(shí)用酷炫的Android開(kāi)源UI框架,靈活運(yùn)用這些UI框架可在日常工作中節(jié)省不少時(shí)間2018-04-04
android表格效果之ListView隔行變色實(shí)現(xiàn)代碼
首先繼承SimpleAdapter再使用重載的Adapter來(lái)達(dá)到效果,其實(shí)主要是需要重載SimpleAdapter,感興趣的朋友可以研究下,希望本文可以幫助到你2013-02-02
Android手機(jī)通過(guò)藍(lán)牙連接佳博打印機(jī)的實(shí)例代碼
這篇文章主要介紹了Android手機(jī)通過(guò)藍(lán)牙連接佳博打印機(jī)的實(shí)例代碼,非常不錯(cuò)具有參考借鑒價(jià)值,需要的朋友可以參考下2016-11-11
kotlin實(shí)現(xiàn)快遞與號(hào)碼歸屬地查詢案例詳解
時(shí)間軸時(shí)一個(gè)很炫酷的效果,一般作用在物流信息上,我們同樣也可以作為一個(gè)學(xué)習(xí)對(duì)象去學(xué)習(xí)他的使用方法,同時(shí)呢,我們可以在線查詢我們的電話號(hào)碼歸屬地,巧用鍵盤(pán)的邏輯提升我們用戶體驗(yàn)2023-02-02
Android變形(Transform)之Camera使用介紹
Camera主要實(shí)現(xiàn)3D的變形,有轉(zhuǎn)動(dòng),旋轉(zhuǎn)等,Camera的源碼是由Native(本地代碼)實(shí)現(xiàn),提供的接口也比較簡(jiǎn)單,感興趣的朋友可以參考下,或許對(duì)你學(xué)習(xí)有所幫助2013-02-02
Android基于OpenCV實(shí)現(xiàn)QR二維碼檢測(cè)
QR碼比普通一維條碼具有快速讀取和更大的存儲(chǔ)資料容量,也無(wú)需要像一維條碼般在掃描時(shí)需要直線對(duì)準(zhǔn)掃描儀。因此其應(yīng)用范圍已經(jīng)擴(kuò)展到包括產(chǎn)品跟蹤,物品識(shí)別,文檔管理,庫(kù)存營(yíng)銷(xiāo)等方面。本文講解Android基于OpenCV實(shí)現(xiàn)QR二維碼檢測(cè)的步驟2021-06-06
Flutter文本Text和輸入框TextField組件使用示例
這篇文章主要為大家介紹了Flutter文本Text和輸入文本框TextField組件使用示例,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2023-08-08

