本文整理汇总了C#中Button.SetTextColor方法的典型用法代码示例。如果您正苦于以下问题:C# Button.SetTextColor方法的具体用法?C# Button.SetTextColor怎么用?C# Button.SetTextColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Button
的用法示例。
在下文中一共展示了Button.SetTextColor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitTabBtnView
private void InitTabBtnView( ) {
tab_btn_writeAdvice = FindViewById<Button>(Resource.Id.tab_btn_writeAdvice);
tab_btn_recordAdvice = FindViewById<Button>(Resource.Id.tab_btn_recordAdvice);
tab_btn_writeAdvice.SetTextColor(Resources.GetColor(Resource.Color.blue));
tab_btn_writeAdvice.SetOnClickListener(this);
tab_btn_recordAdvice.SetOnClickListener(this);
}
示例2: StyleButton
public static void StyleButton( Button button, string text, string font, uint size )
{
// load up the rounded drawable and set the color
Drawable buttonDrawable = (Drawable)Rock.Mobile.PlatformSpecific.Android.Core.Context.Resources.GetDrawable( Resource.Drawable.RoundButton );
buttonDrawable.SetColorFilter( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.Button_BGColor ), PorterDuff.Mode.SrcAtop );
button.Background = buttonDrawable;
button.Text = text;
button.SetAllCaps( false );
button.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( font ), TypefaceStyle.Normal );
button.SetTextSize( Android.Util.ComplexUnitType.Dip, size );
button.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.Button_TextColor ) );
}
示例3: OnCreateView
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
rootview = (RelativeLayout)inflater.Inflate (Resource.Layout.relationshiproot, container, false);
relationshiplistview=(ListView)rootview.FindViewById (Resource.Id.relationshiproot_listview);
//reuse switch tab in raffle root
organizationswitchbut = (Button)rootview.FindViewById (Resource.Id.raffleroot_toptabconfirmed_button);
organizationswitchbut.Text = "Organization";
organizationswitchbut.Click -= OnOrganizationClick;
organizationswitchbut.Click += OnOrganizationClick;
teamswitchbut = (Button)rootview.FindViewById (Resource.Id.raffleroot_toptabpotencial_button);
teamswitchbut.Text="Team";
teamswitchbut.Click -= OnTeamClick;
teamswitchbut.Click += OnTeamClick;
organizationtabindicator = (RelativeLayout)rootview.FindViewById (Resource.Id.raffleroot_toptabconfirmedindicator_relativelayout);
teamtabindicator = (RelativeLayout)rootview.FindViewById (Resource.Id.raffleroot_toptabpotencialindicator_relativelayout);
if (showorganization) {
organizationtabindicator.SetBackgroundResource (Resource.Color.iosblue);
teamtabindicator.SetBackgroundResource (Resource.Color.light_gray);
organizationswitchbut.SetTextColor(Resources.GetColor(Resource.Color.iosblue));
teamswitchbut.SetTextColor(Resources.GetColor(Resource.Color.black));
LoadRelationships ();
} else {
organizationtabindicator.SetBackgroundResource (Resource.Color.light_gray);
teamtabindicator.SetBackgroundResource (Resource.Color.iosblue);
organizationswitchbut.SetTextColor(Resources.GetColor(Resource.Color.black));
teamswitchbut.SetTextColor(Resources.GetColor(Resource.Color.iosblue));
LoadTeam ();
}
return rootview;
}
示例4: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
// Set our view from the "main" layout resource (strings are loaded from Recources -> values -> Strings.xml)
SetContentView(Resource.Layout.Main);
// find and set the controls, so it can be used in the code
buttonConnect = FindViewById<Button>(Resource.Id.buttonConnect);
buttonSwitch1 = FindViewById<Button> (Resource.Id.buttonSwitch1);
buttonSwitch2 = FindViewById<Button> (Resource.Id.buttonSwitch2);
kakuOne = FindViewById<Button>(Resource.Id.buttonOnOff1);
kakuTwo = FindViewById<Button>(Resource.Id.buttonOnOff2);
kakuThree = FindViewById<Button>(Resource.Id.buttonOnOff3);
valOne = FindViewById<TextView>(Resource.Id.textViewValue1);
valTwo = FindViewById<TextView>(Resource.Id.textViewValue2);
valThree = FindViewById<TextView>(Resource.Id.textViewValue3);
thresholdOne = FindViewById<EditText>(Resource.Id.editTextThreshold1);
thresholdTwo = FindViewById<EditText>(Resource.Id.editTextThreshold2);
thresholdThree = FindViewById<EditText>(Resource.Id.editTextThreshold3);
thresholdFour = FindViewById<EditText>(Resource.Id.editTextThreshold4);
updateSpeed = FindViewById<EditText> (Resource.Id.editTextTimerSpeed);
updateSpeedText =FindViewById<TextView>(Resource.Id.textViewTimerSpeedText);
toggleOne = FindViewById<Button>(Resource.Id.buttonToggle1);
toggleTwo = FindViewById<Button>(Resource.Id.buttonToggle2);
toggleThree = FindViewById<Button>(Resource.Id.buttonToggle3);
textViewTimerStateValue = FindViewById<TextView>(Resource.Id.textViewTimerStateValue);
textViewServerConnect = FindViewById<TextView>(Resource.Id.textViewServerConnect);
editTextIPAddress = FindViewById<EditText>(Resource.Id.editTextIPAddress);
editTextIPPort = FindViewById<EditText>(Resource.Id.editTextIPPort);
kakuOne.SetTextColor (Color.Red);
kakuTwo.SetTextColor (Color.Red);
kakuThree.SetTextColor (Color.Red);
toggleOne.SetTextColor (Color.Red);
toggleTwo.SetTextColor (Color.Red);
toggleThree.SetTextColor (Color.Red);
UpdateConnectionState(4, "Disconnected");
// Init commandlist, scheduled by socket timer
commandList.Add(new Tuple<string, TextView>("a", valOne));
commandList.Add(new Tuple<string, TextView>("b", valTwo));
// activation of connector -> threaded sockets otherwise -> simple sockets
connector = new Connector(this);
this.Title = (connector == null) ? this.Title + " (simple sockets)" : this.Title + " (thread sockets)";
// timer object, running clock
timerClock = new System.Timers.Timer() { Interval = 2000, Enabled = true }; // Interval >= 1000
timerClock.Elapsed += (obj, args) =>
{
RunOnUiThread(() => { textViewTimerStateValue.Text = DateTime.Now.ToString("h:mm:ss"); });
RunOnUiThread(() => { valThree.Text = DateTime.Now.ToString("HH:mm"); });
UpdateSpeed();
};
// timer object, check Arduino state
// Only one command can be serviced in an timer tick, schedule from list
timerSockets = new System.Timers.Timer() { Interval = 1000, Enabled = true }; // Interval >= 750
timerSockets.Elapsed += (obj, args) =>
{ RunOnUiThread(
() =>
{
if (connector.socket != null) // only if socket exists
{
// Send a command to the Arduino server on every tick (loop though list)
if (timerSpeedCounter == timerSpeed)
{
UpdateValue();
updateOrder++;
if (updateOrder > 2)
{
updateOrder = 0;
}
}
timerSpeedCounter++;
if (timerSpeedCounter> timerSpeed)
{
timerSpeedCounter = 1;
}
}
});
};
//All the buttons go here.
//Add the "Connect" button handler.
if (buttonConnect != null) // if button exists
{
buttonConnect.Click += (sender, e) =>
{
//Validate the user input (IP address and port)
if (CheckValidIpAddress(editTextIPAddress.Text) && CheckValidPort(editTextIPPort.Text))
{
if (connector == null) // -> simple sockets
{
ConnectSocket(editTextIPAddress.Text, editTextIPPort.Text);
}
else // -> threaded sockets
{
//.........这里部分代码省略.........
示例5: CreateSpringboardButton
void CreateSpringboardButton( RelativeLayout relativeLayout )
{
// create the button
SpringboardRevealButton = new Button( Activity );
// clear the background outline
SpringboardRevealButton.Background = null;
// position it vertically centered and a little right indented
SpringboardRevealButton.LayoutParameters = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
((RelativeLayout.LayoutParams)SpringboardRevealButton.LayoutParameters).AddRule( LayoutRules.CenterVertical );
SpringboardRevealButton.SetX( 10 );
// set the font and text
Typeface fontFace = Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( PrivateControlStylingConfig.Icon_Font_Secondary );
SpringboardRevealButton.SetTypeface( fontFace, TypefaceStyle.Normal );
SpringboardRevealButton.SetTextSize( Android.Util.ComplexUnitType.Dip, PrivatePrimaryNavBarConfig.RevealButton_Size );
SpringboardRevealButton.Text = PrivatePrimaryNavBarConfig.RevealButton_Text;
// use the completely overcomplicated color states to set the normal vs pressed color state.
int [][] states = new int[][]
{
new int[] { Android.Resource.Attribute.StatePressed },
new int[] { Android.Resource.Attribute.StateEnabled },
new int[] { -Android.Resource.Attribute.StateEnabled },
};
// let the "pressed" version just use a darker version of the normal color
uint mutedColor = Rock.Mobile.Graphics.Util.ScaleRGBAColor( ControlStylingConfig.TextField_PlaceholderTextColor, 2, false );
int [] colors = new int[]
{
Rock.Mobile.UI.Util.GetUIColor( mutedColor ),
Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_PlaceholderTextColor ),
Rock.Mobile.UI.Util.GetUIColor( mutedColor ),
};
SpringboardRevealButton.SetTextColor( new Android.Content.Res.ColorStateList( states, colors ) );
// setup the click callback
SpringboardRevealButton.Click += (object sender, System.EventArgs e) =>
{
RevealSpringboard( !SpringboardRevealed );
SpringboardParent.RevealButtonClicked( );
};
relativeLayout.AddView( SpringboardRevealButton );
}
示例6: InitView
private void InitView()
{
//设置标题栏
var btn_header_back = FindViewById<Button> (Resource.Id.btn_header_back);
btn_header_back.Click += (sender, e) =>
{
this.Finish();
};
FindViewById<TextView> (Resource.Id.tv_header_title).Text = "填写短信验证码";
btn_Submit = FindViewById<Button> (Resource.Id.btn_Submit);
btn_Send = FindViewById<Button> (Resource.Id.btn_Send);
tv_PhoneShow = FindViewById<TextView> (Resource.Id.tv_PhoneShow);
edit_SecurityCode = FindViewById<EditText> (Resource.Id.edit_SecurityCode);
tv_SendCodeStatusShow = FindViewById<TextView>(Resource.Id.tv_SendCodeStatusShow);
//取得上一页面传递过来的值
var bundle = Intent.Extras;
//从bundle中获取值赋值显示
phoneNum= bundle.GetString("phoneNum");
nickName = bundle.GetString ("nickName");
passWord = bundle.GetString ("passWord");
securityCode = bundle.GetString("securityCode");
tv_PhoneShow.Text = phoneNum;
//初始化计时器,启动
mc = new MyCount(this,60000,1000);
mc.Start ();
edit_SecurityCode.TextChanged+= (sender, e) =>
{
if(edit_SecurityCode.Text.Length>0)
{
btn_Submit.Enabled = true;
btn_Submit.SetBackgroundResource(Resource.Color.blue);
}
else
{
btn_Submit.Enabled =false;
btn_Submit.SetBackgroundResource(Resource.Color.lightgray);
}
};
btn_Submit.Click += (sender, e) =>
{
var inputCode = edit_SecurityCode.Text;
if(string.IsNullOrEmpty(inputCode) || !EldYoungUtil.IsSecurityCode(inputCode))
{
Toast.MakeText(this,"请输入接收到的手机验证码,且不能为空",ToastLength.Short).Show();
return ;
}
if(inputCode!=securityCode)
{
Toast.MakeText(this,"输入验证码不正确,请重新填写",ToastLength.Short).Show();
return;
}
Reister();
};
//发送验证码
btn_Send.Click += (sender, e) =>
{
tv_SendCodeStatusShow.Visibility = ViewStates.Invisible;
btn_Send.Clickable = false;
btn_Send.SetBackgroundResource(Resource.Color.lightgray);
btn_Send.SetTextColor(Resources.GetColor(Resource.Color.ingray));
SendSMS(phoneNum);
};
}
示例7: RelationshipsTeamCard
public RelationshipsTeamCard(Context context,int type)
: base(context)
{
nn_context=context;
this.LayoutParameters = new ListView.LayoutParams (ListView.LayoutParams.MatchParent,ListView.LayoutParams.WrapContent);
this.SetPadding (TapUtil.dptodx (10), TapUtil.dptodx (10), TapUtil.dptodx (10), TapUtil.dptodx (10));
titlecontaienr = new LinearLayout (nn_context);
titlecontaienr.Orientation = Orientation.Horizontal;
titlecontaienr.Id = TapUtil.generateViewId ();
RelativeLayout.LayoutParams titlecontainerparam = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.WrapContent);
titlecontaienr.LayoutParameters = titlecontainerparam;
organizationimg = new ImageView (nn_context);
LinearLayout.LayoutParams organizationimgparam = new LinearLayout.LayoutParams(TapUtil.dptodx(50),TapUtil.dptodx(50));
organizationimgparam.Gravity = GravityFlags.CenterVertical;
organizationimg.LayoutParameters = organizationimgparam;
titleinfocontainer = new LinearLayout (nn_context);
titleinfocontainer.Orientation = Orientation.Vertical;
LinearLayout.LayoutParams titleinfoparam = new LinearLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.WrapContent);
titleinfocontainer.LayoutParameters = titleinfoparam;
eventnametextview = new TextView (nn_context);
eventnametextview.LayoutParameters = new LinearLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.WrapContent);
eventnametextview.Gravity = global::Android.Views.GravityFlags.Center;
eventnametextview.Text="eventname";
eventnametextview.TextSize = TapUtil.dptodx (fontsize);
eventnametextview.SetTypeface (Typeface.Default, TypefaceStyle.Bold);
organizationnametextview = new TextView (nn_context);
organizationnametextview.LayoutParameters = new LinearLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.WrapContent);
organizationnametextview.Gravity = global::Android.Views.GravityFlags.Center;
organizationnametextview.Text="organizationname";
organizationnametextview.TextSize = TapUtil.dptodx (fontsize);
organizationnametextview.SetTypeface (Typeface.Default, TypefaceStyle.Bold);
statustextview = new TextView(nn_context);
statustextview.Id = TapUtil.generateViewId();
statustextview.Gravity = GravityFlags.Center;
RelativeLayout.LayoutParams statustextviewparam = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.WrapContent);
statustextviewparam.TopMargin = TapUtil.dptodx(10);
statustextviewparam.AddRule(LayoutRules.Below, titlecontaienr.Id);
statustextview.LayoutParameters = statustextviewparam;
actionscontainer = new LinearLayout (nn_context);
actionscontainer.Orientation = Orientation.Horizontal;
RelativeLayout.LayoutParams actionscontainerparam = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.WrapContent);
actionscontainerparam.TopMargin = TapUtil.dptodx (10);
actionscontainerparam.AddRule (LayoutRules.Below, statustextview.Id);
actionscontainer.LayoutParameters = actionscontainerparam;
// type = 0 pending, type= 1 leader,type=2 member, type=3 no group
if (type == 0)
{
statustextview.SetTextColor(Color.Red);
actionscontainer.Orientation = Orientation.Vertical;
teamnametextview = new TextView(nn_context);
teamnametextview.Gravity = GravityFlags.Center;
teamnametextview.SetTypeface(Typeface.Default, TypefaceStyle.Bold);
teamnametextview.TextSize = TapUtil.dptodx(fontsize);
LinearLayout.LayoutParams teamnametextviewparam = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent);
teamnametextviewparam.TopMargin = TapUtil.dptodx(10);
teamleadertextview = new TextView(nn_context);
teamleadertextview.Gravity = GravityFlags.Center;
teamleadertextview.TextSize = TapUtil.dptodx(fontsize);
LinearLayout.LayoutParams teamleadertextviewparam = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent);
teamleadertextviewparam.TopMargin = TapUtil.dptodx(10);
actionscontainer.AddView(teamnametextview);
actionscontainer.AddView(teamleadertextview);
}
else if (type == 1) {
statustextview.SetTextColor(Color.Blue);
actionscontainer.Orientation = Orientation.Horizontal;
actionscontainer.SetPadding(TapUtil.dptodx(10), TapUtil.dptodx(10), TapUtil.dptodx(10), TapUtil.dptodx(10));
var button1container = new LinearLayout(nn_context);
var button1containerparam = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent);
button1containerparam.Weight = 1;
button1container.LayoutParameters = button1containerparam;
button1container.SetPadding(TapUtil.dptodx(5), TapUtil.dptodx(5), TapUtil.dptodx(5), TapUtil.dptodx(5));
button1container.SetGravity(GravityFlags.Center);
invitebutton = new Button(nn_context);
LinearLayout.LayoutParams invitebuttonparam = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent);
invitebutton.LayoutParameters = invitebuttonparam;
invitebutton.SetBackgroundResource(Resource.Color.iosblue);
invitebutton.SetTextColor(Color.White);
invitebutton.SetTypeface(Typeface.Default, TypefaceStyle.Bold);
button1container.AddView(invitebutton);
//.........这里部分代码省略.........
示例8: InitTextView
private void InitTextView( ) {
btnTabmyHealth = View.FindViewById<Button>(Resource.Id.btn_tab_myHealth);
btnTabotherHealth = View.FindViewById<Button>(Resource.Id.btn_tab_otherHealth);
btnTabmyHealth.SetTextColor(Resources.GetColor(Resource.Color.blue));
btnTabmyHealth.SetOnClickListener(this);
btnTabotherHealth.SetOnClickListener(this);
}
示例9: RenderMail
private void RenderMail(Array TRs)
{
Loading("");
Refresh = "Mail";
RunOnUiThread (() =>
{
SetContentView(Resource.Layout.Mail);
LinearLayout Main = FindViewById<LinearLayout>(Resource.Id.MyMainLayout);
RelativeLayout RemoveMe = FindViewById<RelativeLayout>(Resource.Id.RemoveMe);
Main.RemoveView(RemoveMe);
Button BLogout = FindViewById<Button>(Resource.Id.Back);
BLogout.Click += delegate
{ ThreadPool.QueueUserWorkItem(o => Logout()); };
Button BCompose = FindViewById<Button>(Resource.Id.Compose);
BCompose.Click += delegate
{ ThreadPool.QueueUserWorkItem(o => Compose()); };
int CNT = 0;
RelativeLayout.LayoutParams MyPars;
foreach (HtmlNode TR in TRs)
{
CNT++;
if (CNT <= 2 || CNT == TRs.Length)
continue;
string HTML = TR.InnerHtml;
HtmlDocument doc = new HtmlDocument();
doc.LoadHtml(HTML);
HtmlNode node = doc.DocumentNode;
HtmlNode a = node.Descendants("a").Last();
string ID = a.Attributes.First().Value;
ID = ID.Split('=')[1];
string From = a.InnerText;
HtmlNode Temp;
Array Fonts = node.Descendants("font").ToArray();
Temp = (HtmlNode) Fonts.GetValue(2);
string Time = Temp.InnerText;
Temp = (HtmlNode) Fonts.GetValue(3);
string Where = Temp.InnerText;
Temp = (HtmlNode) Fonts.GetValue(4);
string MSG = Regex.Split(Temp.InnerText, "\\\n")[0];
RelativeLayout NewLayout = new RelativeLayout(this);
if (CNT % 2 == 0)
NewLayout.SetBackgroundColor(Color.ParseColor("#F0E68C"));
else
NewLayout.SetBackgroundColor(Color.ParseColor("#D1CD76"));
MyPars = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
MyPars.AddRule(LayoutRules.AlignParentLeft);
MyPars.AddRule(LayoutRules.AlignParentTop);
TextView Mittente = new TextView(this)
{ Text = From };
Mittente.Id = 6901;
Mittente.LayoutParameters = MyPars;
Mittente.SetTextColor(Color.Black);
NewLayout.AddView(Mittente);
MyPars = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
MyPars.AddRule(LayoutRules.AlignParentRight);
MyPars.AddRule(LayoutRules.AlignParentTop);
TextView Locazione = new TextView(this)
{ Text = Where };
Locazione.Id = 6902;
Locazione.LayoutParameters = MyPars;
Locazione.SetTypeface(Locazione.Typeface, TypefaceStyle.Italic);
Locazione.SetTextColor(Color.Black);
NewLayout.AddView(Locazione);
MyPars = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
MyPars.AddRule(LayoutRules.CenterHorizontal);
MyPars.AddRule(LayoutRules.Below, 6901);
TextView Testo = new TextView(this)
{ Text = MSG };
Testo.Id = 6903;
Testo.LayoutParameters = MyPars;
Testo.SetTypeface(Testo.Typeface, TypefaceStyle.Bold);
Testo.SetTextColor(Color.Black);
NewLayout.AddView(Testo);
MyPars = new RelativeLayout.LayoutParams(150, 45);
MyPars.AddRule(LayoutRules.AlignParentLeft);
MyPars.AddRule(LayoutRules.Below, 6903);
Button Leggi = new Button(this)
{ Text = "Leggi" };
Leggi.Id = 6904;
Leggi.LayoutParameters = MyPars;
Leggi.SetBackgroundResource(Resource.Drawable.LotButton);
Leggi.SetTextColor(Color.White);
Leggi.SetTextSize(Android.Util.ComplexUnitType.Dip, 15);
Leggi.Click += delegate
{ ThreadPool.QueueUserWorkItem(o => ReadMail(ID)); };
NewLayout.AddView(Leggi);
MyPars = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
//.........这里部分代码省略.........
示例10: InitView
private void InitView( ) {
btnTabmyGuardian = View.FindViewById<Button>(Resource.Id.btn_tab_myGuardian);
btnTabotherGuardian = View.FindViewById<Button>(Resource.Id.btn_tab_otherGuardian);
btnTabmyGuardian.SetTextColor(Resources.GetColor(Resource.Color.blue));
btnTabmyGuardian.SetOnClickListener(this);
btnTabotherGuardian.SetOnClickListener(this);
//设置viewpager
guardianViewPager = (ViewPager) View.FindViewById<ViewPager>(Resource.Id.guardianViewpager);
fragmentsList = new List<Fragment>();
_myGuardianFrag = new MyGuardianFrag();
_otherGuardianFrag = new OtherGuardianFrag();
fragmentsList.Add(_myGuardianFrag);
fragmentsList.Add(_otherGuardianFrag);
//关闭预加载,默认一次只加载一个Fragment
guardianViewPager.OffscreenPageLimit =1;
guardianViewPager.Adapter = new ViewFragmentPagerAdapter(fragmentsList,ChildFragmentManager);
guardianViewPager.AddOnPageChangeListener (this);
guardianViewPager.SetCurrentItem (0, true);
ll_actionBar = View.FindViewById<LinearLayout> (Resource.Id.ll_actionBar);
//弹出popupwindow,绑定监护人和监护人申请
btn_bindGuardian = View.FindViewById<Button> (Resource.Id.btn_BindGuardian);
btn_bindGuardian.Click += (sender, e) =>
{
BackgroundAlpha(0.5f);
if(guardianPopupWindow!=null)
guardianPopupWindow.ShowAsDropDown(ll_actionBar,-100,1,GravityFlags.Right|GravityFlags.Top);
else
{
InitPopupWindow();
}
};
}
示例11: Initialize
private void Initialize()
{
try
{
_chooseFromContactsButton = FindViewById<Button>(Resource.Id.chooseFromContButton);
_confirmButton = FindViewById<Button>(Resource.Id.confirmButton);
_cancelButton = FindViewById<Button>(Resource.Id.cancelButton);
_editText = FindViewById<EditText>(Resource.Id.playerName);
_playerImageButton = FindViewById<ImageButton>(Resource.Id.playerImage);
SetFont(_cancelButton);
SetFont(_confirmButton);
SetFont(_chooseFromContactsButton);
SetFontItalic(_editText);
_confirmButton.Background.Alpha = 255;
_confirmButton.SetTextColor(Resources.GetColor(Resource.Color.white));
_cancelButton.Background.Alpha = 255;
_cancelButton.SetTextColor(Resources.GetColor(Resource.Color.white));
_confirmButton.Enabled = true; SetConfirmButtonEnabled(false);
_player = new Player();
//To set _playImage to default
PlayerImagePath = null;
}
catch (Exception exception)
{
GaService.TrackAppException(this.Class, "Initialize", exception, false);
}
}
示例12: Refresh
private void Refresh(string what = "")
{
if (activeObject != null && this.Activity != null) {
// Assign this item's values to the various subviews
((ActionBarActivity)Activity).SupportActionBar.SetDisplayShowHomeEnabled(true);
string name = activeObject.Name == null ? "" : activeObject.Name;
if (what.Equals ("") || what.Equals ("Name"))
{
if (activeObject is Task)
((ActionBarActivity)Activity).SupportActionBar.Title = (((Task)activeObject).Complete ? (((Task)activeObject).CorrectState == TaskCorrectness.NotCorrect ? Strings.TaskNotCorrect : Strings.TaskCorrect) + " " : "") + name;
else
((ActionBarActivity)Activity).SupportActionBar.Title = name;
}
if (what.Equals ("") || what.Equals ("Media")) {
Bitmap bm = null;
if (activeObject.Image != null) {
imageView.SetImageBitmap (ctrl.ConvertMediaToBitmap(activeObject.Image));
imageView.Visibility = ViewStates.Visible;
} else {
imageView.Visibility = ViewStates.Gone;
}
}
if (what.Equals ("") || what.Equals ("Description")) {
if (!String.IsNullOrWhiteSpace (activeObject.Description)) {
textDescription.Visibility = ViewStates.Visible;
textDescription.Text = activeObject.Description; // Html.FromHtml(activeObject.HTML.Replace("<BR>", "<br>").Replace("<br>\n", "<br>").Replace("\n", "<br>"));
textDescription.Gravity = GravityFlags.Left;
} else {
textDescription.Visibility = ViewStates.Visible;
textDescription.Text = "";
textDescription.Gravity = GravityFlags.Left;
}
}
// Tasks don't have any command button
if (activeObject is Task)
return;
if (layoutButtons.Visibility == ViewStates.Visible) {
layoutButtons.RemoveAllViews ();
commands = ((Thing)activeObject).ActiveCommands;
for (int i = 0; i < commands.Count; i++) {
Button btnView = new Button (Activity.ApplicationContext) {
Text = commands[i].Text,
Tag = i
};
btnView.SetTextColor(Color.Black);
btnView.SetHighlightColor(Color.Black);
btnView.SetBackgroundResource(Resource.Drawable.apptheme_btn_default_holo_light);
btnView.Click += OnButtonClicked;
layoutButtons.AddView (btnView);
}
}
if (layoutWorksWith.Visibility == ViewStates.Visible) {
layoutWorksWith.RemoveViews(1,layoutWorksWith.ChildCount-1);
if (targets.Count == 0) {
textWorksWith.Text = com.EmptyTargetListText;
Button btnView = new Button (Activity.ApplicationContext);
btnView.SetTextColor(Color.Black);
btnView.SetHighlightColor(Color.Black);
btnView.SetBackgroundResource(Resource.Drawable.apptheme_btn_default_holo_light);
btnView.Text = GetString(Resource.String.ok);
btnView.Click += OnNothingClicked;
layoutWorksWith.AddView (btnView);
} else {
textWorksWith.Text = com.Text;
for (int i = 0; i < targets.Count; i++) {
Button btnView = new Button (Activity.ApplicationContext);
btnView.SetTextColor(Color.Black);
btnView.SetHighlightColor(Color.Black);
btnView.SetBackgroundResource(Resource.Drawable.apptheme_btn_default_holo_light);
btnView.Text = targets[i].Name;
btnView.Tag = i;
btnView.Click += OnThingClicked;
layoutWorksWith.AddView (btnView);
}
}
}
// Resize scrollview
layoutDefault.Invalidate();
}
}
示例13: MakeButtonEnabled
public static void MakeButtonEnabled(this Activity activity, Button button, bool enabled)
{
button.Enabled = enabled;
button.Background.Alpha = enabled ? 255 : 50;
button.SetTextColor(activity.Resources.GetColor(enabled
? Resource.Color.white
: Resource.Color.pressed_text_color));
}
示例14: MessageListItem
public MessageListItem( Context context ) : base( context )
{
SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BackgroundColor ) );
LayoutParameters = new AbsListView.LayoutParams( LayoutParams.MatchParent, LayoutParams.MatchParent );
Orientation = Orientation.Vertical;
LinearLayout contentLayout = new LinearLayout( Rock.Mobile.PlatformSpecific.Android.Core.Context );
contentLayout.LayoutParameters = new LinearLayout.LayoutParams( LayoutParams.MatchParent, LayoutParams.MatchParent );
contentLayout.Orientation = Orientation.Horizontal;
AddView( contentLayout );
TitleLayout = new LinearLayout( Rock.Mobile.PlatformSpecific.Android.Core.Context );
TitleLayout.LayoutParameters = new LinearLayout.LayoutParams( LayoutParams.MatchParent, LayoutParams.WrapContent );
TitleLayout.Orientation = Orientation.Vertical;
( (LinearLayout.LayoutParams)TitleLayout.LayoutParameters ).Weight = 1;
( (LinearLayout.LayoutParams)TitleLayout.LayoutParameters ).Gravity = GravityFlags.CenterVertical;
( (LinearLayout.LayoutParams)TitleLayout.LayoutParameters ).LeftMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 15 );
( (LinearLayout.LayoutParams)TitleLayout.LayoutParameters ).TopMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 15 );
( (LinearLayout.LayoutParams)TitleLayout.LayoutParameters ).BottomMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 15 );
contentLayout.AddView( TitleLayout );
Title = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
Title.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
Title.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Bold ), TypefaceStyle.Normal );
Title.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Medium_FontSize );
Title.SetSingleLine( );
Title.Ellipsize = Android.Text.TextUtils.TruncateAt.End;
Title.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.Label_TextColor ) );
TitleLayout.AddView( Title );
Date = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
Date.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
Date.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Regular ), TypefaceStyle.Normal );
Date.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Small_FontSize );
Date.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_PlaceholderTextColor ) );
( (LinearLayout.LayoutParams)Date.LayoutParameters ).TopMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( -4 );
TitleLayout.AddView( Date );
Speaker = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
Speaker.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
Speaker.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Regular ), TypefaceStyle.Normal );
Speaker.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Small_FontSize );
Speaker.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_PlaceholderTextColor ) );
( (LinearLayout.LayoutParams)Speaker.LayoutParameters ).TopMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( -4 );
Speaker.SetMaxLines( 1 );
TitleLayout.AddView( Speaker );
// add our own custom seperator at the bottom
View seperator = new View( Rock.Mobile.PlatformSpecific.Android.Core.Context );
seperator.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, 0 );
seperator.LayoutParameters.Height = 2;
seperator.SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_BorderColor ) );
AddView( seperator );
// setup the buttons
LinearLayout buttonLayout = new LinearLayout( Rock.Mobile.PlatformSpecific.Android.Core.Context );
buttonLayout.LayoutParameters = new LinearLayout.LayoutParams( LayoutParams.MatchParent, LayoutParams.MatchParent );
( (LinearLayout.LayoutParams)buttonLayout.LayoutParameters ).Weight = 1;
buttonLayout.Orientation = Orientation.Horizontal;
contentLayout.AddView( buttonLayout );
Typeface buttonFontFace = Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( PrivateControlStylingConfig.Icon_Font_Secondary );
ListenButton = new Button( Rock.Mobile.PlatformSpecific.Android.Core.Context );
ListenButton.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
( (LinearLayout.LayoutParams)ListenButton.LayoutParameters ).Weight = 1;
( (LinearLayout.LayoutParams)ListenButton.LayoutParameters ).Gravity = GravityFlags.CenterVertical;
ListenButton.SetTypeface( buttonFontFace, TypefaceStyle.Normal );
ListenButton.SetTextSize( Android.Util.ComplexUnitType.Dip, PrivateNoteConfig.Details_Table_IconSize );
ListenButton.Text = PrivateNoteConfig.Series_Table_Listen_Icon;
ListenButton.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( NoteConfig.Details_Table_IconColor ) );
ListenButton.Background = null;
buttonLayout.AddView( ListenButton );
WatchButton = new Button( Rock.Mobile.PlatformSpecific.Android.Core.Context );
WatchButton.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
( (LinearLayout.LayoutParams)WatchButton.LayoutParameters ).Weight = 1;
( (LinearLayout.LayoutParams)WatchButton.LayoutParameters ).Gravity = GravityFlags.CenterVertical;
WatchButton.SetTypeface( buttonFontFace, TypefaceStyle.Normal );
WatchButton.SetTextSize( Android.Util.ComplexUnitType.Dip, PrivateNoteConfig.Details_Table_IconSize );
WatchButton.Text = PrivateNoteConfig.Series_Table_Watch_Icon;
WatchButton.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( NoteConfig.Details_Table_IconColor ) );
WatchButton.Background = null;
buttonLayout.AddView( WatchButton );
TakeNotesButton = new Button( Rock.Mobile.PlatformSpecific.Android.Core.Context );
TakeNotesButton.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
( (LinearLayout.LayoutParams)TakeNotesButton.LayoutParameters ).Weight = 1;
( (LinearLayout.LayoutParams)TakeNotesButton.LayoutParameters ).Gravity = GravityFlags.CenterVertical;
TakeNotesButton.SetTypeface( buttonFontFace, TypefaceStyle.Normal );
TakeNotesButton.SetTextSize( Android.Util.ComplexUnitType.Dip, PrivateNoteConfig.Details_Table_IconSize );
TakeNotesButton.Text = PrivateNoteConfig.Series_Table_TakeNotes_Icon;
TakeNotesButton.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( NoteConfig.Details_Table_IconColor ) );
TakeNotesButton.Background = null;
buttonLayout.AddView( TakeNotesButton );
ListenButton.Click += (object sender, EventArgs e ) =>
{
//.........这里部分代码省略.........
示例15: Refresh
void Refresh()
{
if (input == null) {
// Normal dialog
// TODO: HTML
textDescription.Text = messageBox.Text; // Html.FromHtml(messageBox.HTML.Replace("<BR>", "<br>").Replace("<br>\n", "<br>").Replace("\n", "<br>"));
textDescription.Gravity = GravityFlags.Left;
if (messageBox.Image != null) {
imageView.SetImageBitmap (ctrl.ConvertMediaToBitmap(messageBox.Image));
imageView.Visibility = ViewStates.Visible;
} else {
imageView.Visibility = ViewStates.Gone;
}
if (!String.IsNullOrEmpty (messageBox.FirstButtonLabel)) {
btnView1.Visibility = ViewStates.Visible;
btnView1.Text = messageBox.FirstButtonLabel;
} else
btnView1.Visibility = ViewStates.Gone;
if (!String.IsNullOrEmpty (messageBox.SecondButtonLabel)) {
btnView2.Visibility = ViewStates.Visible;
btnView2.Text = messageBox.SecondButtonLabel;
} else
btnView2.Visibility = ViewStates.Gone;
} else {
// TODO: HTML
textDescription.Text = input.Text; // Html.FromHtml(input.HTML.Replace("<BR>", "<br>").Replace("<br>\n", "<br>").Replace("\n", "<br>"));
textDescription.Gravity = GravityFlags.Left;
if (input.Image != null) {
imageView.SetImageBitmap (ctrl.ConvertMediaToBitmap(input.Image));
imageView.Visibility = ViewStates.Visible;
} else {
imageView.Visibility = ViewStates.Gone;
}
if (input.InputType == InputType.MultipleChoice) {
// Multiple choice dialog
layoutMultipleChoice.RemoveAllViews ();
foreach (string s in input.Choices) {
Button btnView = new Button (Activity.ApplicationContext);
btnView.SetBackgroundResource(Resource.Drawable.apptheme_btn_default_holo_light);
btnView.SetTextColor(Color.Black);
btnView.SetHighlightColor(Color.Black);
btnView.Text = s;
btnView.Click += OnChoiceClicked;
layoutMultipleChoice.AddView (btnView);
}
} else {
// Input dialog
// ToDo: Clear text field editInput
}
}
}