當前位置:首頁 » 安卓系統 » android瀏覽控制項

android瀏覽控制項

發布時間: 2023-07-25 04:17:10

⑴ 最新的Android控制項有哪些

1.MaterialStepperView
它是用Material Design實現Steppers的。

目前,Stepper只有垂直視圖,但將來會有更多的風格。你可以嘗試一下,如下圖:
你可以自定義normal/active兩個狀態的顏色,完成圖標,開啟動畫並設置動畫時長。可通過Github上的設置項和樣式查閱所有設置項。該庫支持API 17+,詳情請查閱wiki文檔。

2. MultiSnapRecyclerView
這是分屏滾動的Android庫。
MultiSnapRecyclerView為RecyclerView提供了分屏功能。

目前提供的功能有:
start, end和center三個位置的吸附,
snap count 指定要分屏的數量,
支持水平和垂直分屏,
滾動時的回調。
3. Garland View for Android
該庫可實現如下的布局:

GarlandView 外部是一個水平滾動的視圖,視圖內的每一個子視圖可垂直滾動。
你可以在README中找到其他重要信息。還有一個示例App。該庫支持API 19及更高版本。
4. VegaLayoutManager
這是一個自定義的布局管理器——滾動時縮小並淡出頭部。這是受到Dribble項目的啟發。

5. ExpandableLayout
這個庫的名字不言而喻,它是一個基於LinearLayout的可擴展的布局。
README里含有你啟動時需要的所有信息,另外,還有一個示例App可以幫助你快速跳轉到代碼中。
6. SwipeBackLayout
SwipeBackLayout允許你使用手勢返回上一個界面。
你可以設置滑動方向,如從左到右、從右到左、從頂部到底部、從底部到頂部。
你還可以設置是否只能從邊緣滑動。
SwipeBackLayout只能包含一個子布局,例如:
LinearLayout,RelativeLayout,FrameLayout,TableLayout等。
ScrollView,HorizontalScrollView,NestedScrollView等。
RecyclerView,AbsListView(ListView)等子類。
ViewPager,WebView等。
該項目裡面有一個詳細說明的文檔、示例APP和一個APK。

⑵ android界面控制項

PopupWindow類,你網上搜索一下使用方法!

⑶ android怎麼獲取 中的控制項

在實際開發中LayoutInflater這個類還是非常有用的,它的作用類似於findViewById()。不同點是LayoutInflater是用來找res/layout/下的xml布局文件代碼塊,並且實例化;而findViewById()是找xml布局文件下的具體widget控制項(如Button、TextView等)。 具體作用:
1、對於一個沒有被載入或者想要動態載入的界面,都需要使用LayoutInflater.inflate()來載入;
2、對於一個已經載入的界面,就可以使用Activiyt.findViewById()方法來獲得其中的界面元素。
LayoutInflater 是一個抽象類,在文檔中如下聲明:
public abstract class LayoutInflater extends Object
獲得 LayoutInflater 實例的三種方式:
1.LayoutInflater inflater = getLayoutInflater(); //調用Activity的getLayoutInflater()
2.LayoutInflater localinflater =(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
1. LayoutInflater inflater = LayoutInflater.from(context);
其實,這三種方式本質是相同的,從源碼中可以看出:
getLayoutInflater():
Activity 的 getLayoutInflater() 方法是調用 PhoneWindow 的getLayoutInflater()方法,看一下該源代碼:
public PhoneWindow(Context context) {
super(context);
mLayoutInflater = LayoutInflater.from(context);
}
可以看出它其實是調用 LayoutInflater.from(context)。
LayoutInflater.from(context):
public static LayoutInflater from(Context context) {
LayoutInflater LayoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
if (LayoutInflater ==null) {
throw new AssertionError("LayoutInflater not found.");
}
return LayoutInflater;
}
可以看出它其實調用 context.getSystemService()。
結論:所以這三種方式最終本質是譽基胡都是調慶攔用的Context.getSystemService()。鋒伍
inflate 方法 通過 sdk 的 api 文檔,可以知道該方法有以下幾種過載形式,返回值均是 View 對象,如下:
public View inflate (int resource, ViewGroup root);
3 public View inflate (XmlPullParser parser, ViewGroup root);
4 public View inflate (XmlPullParser parser, ViewGroup root, boolean attachToRoot);
5 public View inflate (int resource, ViewGroup root, boolean attachToRoot);
6
7 LayoutInflater inflater = (LayoutInflater)getSystemService(LAYOUT_INFLATER_SERVICE);
8 View view = inflater.inflate(R.layout.custom, (ViewGroup)findViewById(R.id.test));
9 //EditText editText = (EditText)findViewById(R.id.content);
10 // error
EditText editText = (EditText)view.findViewById(R.id.content);
對於上面代碼,指定了第二個參數 ViewGroup root,當然你也可以設置為 null 值。
注意:
·inflate方法與 findViewById 方法不同;
·inflater 是用來找 res/layout下的 xml 布局文件,並且實例化;
·findViewById() 是找具體 xml 布局文件中的具體 widget 控制項(如:Button、TextView 等)。

熱點內容
死鎖避免的演算法 發布:2025-02-05 04:43:07 瀏覽:579
python查文檔 發布:2025-02-05 04:27:49 瀏覽:496
javaxmldom 發布:2025-02-05 04:27:40 瀏覽:9
linux修改內存大小 發布:2025-02-05 04:26:05 瀏覽:997
ftp命令復制文件 發布:2025-02-05 04:26:00 瀏覽:303
python好用的ide 發布:2025-02-05 04:14:18 瀏覽:516
id密碼開頭是多少 發布:2025-02-05 04:11:51 瀏覽:101
數據結構c語言ppt 發布:2025-02-05 04:11:45 瀏覽:43
如何用學習機配置的筆寫字 發布:2025-02-05 04:09:15 瀏覽:395
5歲編程 發布:2025-02-05 04:06:21 瀏覽:653