0
我使用TabHost爲android xml中的標籤式佈局。我如何設計標籤?Xamarin:風格TabWidget
選中的標籤應該鼓起了如下圖。我如何設置邊界到標籤?和盒子陰影?
XML對於每個標籤,
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/ic_tab_speakers_selected"
android:state_selected="true"/>
<item android:drawable="@drawable/ic_tab_speakers_unselected"/>
</selector>
我管理通過使用以下代碼來設置背景顏色:
TabWidget.GetChildAt(0).SetBackgroundColor(Android.Graphics.Color.ParseColor("#8ACAE1"));
這裏是我用來創建tabWidget代碼,
TabHost.TabSpec spec;
TabHost.SetBackgroundColor(Android.Graphics.Color.ParseColor("#4B4B4B"));
var intent = new Intent(this, activityType);
intent.AddFlags(ActivityFlags.NewTask);
spec = TabHost.NewTabSpec(tag);
var drawableIcon = Resources.GetDrawable(drawableId);
spec.SetIndicator("", drawableIcon);
spec.SetContent(intent);
TabHost.AddTab(spec);
請幫忙, 謝謝。
「context」代表什麼?和TabContentFactory無法找到?班級名稱? –
這是C# - Xamarin Android代碼嗎? –
抱歉..這是android代碼 – user543