之前幾篇文章,是利用一個網路上的open source ( https://github.com/Cheesebaron/ViewPagerIndicator ) 來製作,但是後來發現原來Xamarin Component 裡面有一個 Material Pager Sliding Tab Strip 也有一個可以做出滑動的Slider Tab ,基本上就是中規中矩比較符合Material Design
兼任的偽善者,part-time的故事家,業餘的code generator,不服輸的夢想家,長不大的幼稚鬼,一個撿技術破爛的中年大叔
之前幾篇文章,是利用一個網路上的open source ( https://github.com/Cheesebaron/ViewPagerIndicator ) 來製作,但是後來發現原來Xamarin Component 裡面有一個 Material Pager Sliding Tab Strip 也有一個可以做出滑動的Slider Tab ,基本上就是中規中矩比較符合Material Design
遇到錯誤訊息 Java.Lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity. 怎麼解決呢?
承襲上一篇 [Xamarin] 可滑動Tab 實作 我們製作了可以滑動的 Tab ,但是style 方面有點複雜寫一篇紀錄一下,看一下完成後結果是長這樣,基本上我用色比較誇張這樣就可以知道要改那些地方
之前分享一篇文章關於 Android 製作滑動含手勢輪播廣告 但是那時候用的圖片是由內建的資源,因為剛好朋友在問我這問題,我就順手改寫了一段讓他支援網路圖片,並且點擊之後會有觸發Toast 事件
1.先下載 Source Code ( https://github.com/donma/Xamarin.TestSliderAutoPlay )
之前在 製作過ListActivity (http://no2don.blogspot.tw/2013/07/xamarin-listactivity.html) ,今天我們聊聊使用ListFragment 來製作列表,至於為什麼呢?因為現在官方很多範例都是用ListFragment
最近在在處理圖形問題,需求是必須要合成Barcode,這點不困難,只需要下載barcode 字型檔.ttf 就可以了,但是讀取後拿來畫在bitmap上面,之後那ttf檔案就被系統鎖起來,刪都刪不掉,即使我dispose 一堆東西也一樣,後來網路上查到一些作法,乾脆整理成一個function 之後就讀取.ttf 變成Font 物件,而且不會被系統lock住
private static Font GetFontFromFileWithoutLock(float size,string fontPath)
{var fontBytes = System.IO.File.ReadAllBytes(fontPath);
//讀到記憶體中var fontBuffer = Marshal.AllocHGlobal(fontBytes.Length);
Marshal.Copy(fontBytes, 0, fontBuffer, fontBytes.Length);
PrivateFontCollection privateFont = new PrivateFontCollection(); //從記憶體取得privateFont.AddMemoryFont(fontBuffer, fontBytes.Length);
var res = new Font(privateFont.Families[0], size);privateFont.Dispose();
return res;}
很簡單,給需要的人
主要來自於官方範例,教你如何製作 Splash Screen (https://developer.xamarin.com/guides/android/user_interface/creating_a_splash_screen/) ,因為測試了一下,他都不會全螢幕,執行起來是長得像是下面這樣子