本文整理汇总了C#中RelativeLayout.FindViewById方法的典型用法代码示例。如果您正苦于以下问题:C# RelativeLayout.FindViewById方法的具体用法?C# RelativeLayout.FindViewById怎么用?C# RelativeLayout.FindViewById使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RelativeLayout
的用法示例。
在下文中一共展示了RelativeLayout.FindViewById方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnCreateView
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
rootview = (RelativeLayout)inflater.Inflate (Resource.Layout.raffleroot, container, false);
locationcontainerlayout=(LinearLayout)rootview.FindViewById (Resource.Id.raffleroot_locationcontainer_linerlayout);
TextView locationtext=new TextView(nn_activity);
locationtext.Text=nn_location;
LinearLayout.LayoutParams param=new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WrapContent,LinearLayout.LayoutParams.WrapContent);
param.Gravity=global::Android.Views.GravityFlags.Center;
param.LeftMargin=TapUtil.dptodx(5);
locationtext.LayoutParameters=param;
locationcontainerlayout.AddView (locationtext);
//initialize listview
listview=(ListView)rootview.FindViewById(Resource.Id.raffleroot_eventlist_listview);
listview.Divider = null;
adapter = new EventListAdapter (nn_activity,eventcards);
listview.Adapter = adapter;
//adapter.NotifyListChange ();
listview.ItemClick+= (object sender, AdapterView.ItemClickEventArgs e) => {
(nn_activity as HomeScreen).ShowRaffleDetailFragment(e.Position);
};
return rootview;
}
示例2: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate (bundle);
// Set our view from the "main" layout resource
SetContentView (Resource.Layout.Main);
mainLayout = FindViewById<RelativeLayout> (Resource.Id.MainLayout);
disclaimer = FindViewById<RelativeLayout> (Resource.Id.rlDisclaimer);
RelativeLayout.LayoutParams rlp = (RelativeLayout.LayoutParams)disclaimer.LayoutParameters;
diff = rlp.Height + rlp.BottomMargin;
TextView label1 = FindViewById<TextView> (Resource.Id.label1);
label1.Text = "bla bla bla qsf qsdf qdsf qsdf qsd\n sdfqsf qs\n sdf qsdf qsf qs\n";
float width = label1.Paint.MeasureText (label1.Text);
text = disclaimer.FindViewById<TextView> (Resource.Id.disclaimerText);
//SetText in OnCreate ()
RunOnUiThread (() => {
text.Text = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";
});
LinearLayout lin = FindViewById<LinearLayout> (Resource.Id.llTestLayout);
lin.LayoutParameters.Width = (int)width;
RelativeLayout test = FindViewById<RelativeLayout> (Resource.Id.clickLayout);
test.SetOnTouchListener (this);
}
示例3: ActionBar
public ActionBar(Context context, IAttributeSet attrs)
: base(context, attrs)
{
m_Context = context;
m_Inflater = (LayoutInflater)context.GetSystemService(Context.LayoutInflaterService);
m_BarView = (RelativeLayout)m_Inflater.Inflate(Resource.Layout.ActionBar, null);
AddView(m_BarView);
m_LogoView = m_BarView.FindViewById<ImageView>(Resource.Id.actionbar_home_logo);
m_HomeLayout = m_BarView.FindViewById<RelativeLayout>(Resource.Id.actionbar_home_bg);
m_HomeBtn = m_BarView.FindViewById<ImageButton>(Resource.Id.actionbar_home_btn);
m_BackIndicator = m_BarView.FindViewById(Resource.Id.actionbar_home_is_back);
m_TitleView = m_BarView.FindViewById<TextView>(Resource.Id.actionbar_title);
m_ActionsView = m_BarView.FindViewById<LinearLayout>(Resource.Id.actionbar_actions);
m_Progress = m_BarView.FindViewById<ProgressBar>(Resource.Id.actionbar_progress);
m_TitleLayout = m_BarView.FindViewById<RelativeLayout>(Resource.Id.actionbar_title_layout);
//check if pre-honeycomb. Ideally here you would actually want to check if a menu button exists.
//however on all pre-honeycomb phones they basically did.
var currentapiVersion = (int)Build.VERSION.SdkInt;
m_HasMenuButton = currentapiVersion <= 10;
m_OverflowAction = new OverflowActionBarAction(context);
//Custom Attributes (defined in Attrs.xml)
var a = context.ObtainStyledAttributes(attrs,
Resource.Styleable.ActionBar);
var title = a.GetString(Resource.Styleable.ActionBar_title);
if (null != title)
Title = title;
var titleColor = a.GetColor(Resource.Styleable.ActionBar_title_color, Resources.GetColor(Resource.Color.actionbar_title));
TitleColor = titleColor;
var separatorColor = a.GetColor(Resource.Styleable.ActionBar_separator, Resources.GetColor(Resource.Color.actionbar_separator));
m_ActionsView.SetBackgroundColor(separatorColor);
using (var background = a.GetDrawable(Resource.Styleable.ActionBar_background)) //recycling the drawable immediately
{
if (null != background)
BackgroundDrawable = background;
}
var backgroundItem = a.GetDrawable(Resource.Styleable.ActionBar_background_item);
if (null != backgroundItem)
ItemBackgroundDrawable = backgroundItem;
a.Recycle();
}
示例4: 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);
relationshiplist = new List<Tap5050Relationships> ();
adapter = new RelationshipListAdapter (this, ref relationshiplist);
relationshiplistview.Adapter = adapter;
adapter.NotifyDataSetChanged ();
return rootview;
}
示例5: OnCreateView
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
rootview = (RelativeLayout)inflater.Inflate (Resource.Layout.account_resetpassword, container, false);
oldpasslabel = (TextView)rootview.FindViewById (Resource.Id.resetpassword_oldpasslabel_textview);
oldpasslabel.Text =ResetPasswordScreenData.OldPass;
oldpassedittext = (EditText)rootview.FindViewById (Resource.Id.resetpassword_oldpass_edittext);
oldpassedittext.Hint = ResetPasswordScreenData.OldPass;
oldpassedittext.InputType = global::Android.Text.InputTypes.TextVariationPassword;
oldpassedittext.TransformationMethod = PasswordTransformationMethod.Instance;
newpasslabel = (TextView)rootview.FindViewById (Resource.Id.resetpassword_newpasslabel_textview);
newpasslabel.Text = ResetPasswordScreenData.NewPass;
newpassedittext = (EditText)rootview.FindViewById (Resource.Id.resetpassword_newpass_edittext);
newpassedittext.Hint = ResetPasswordScreenData.NewPass;
newpassedittext.InputType = global::Android.Text.InputTypes.TextVariationPassword;
newpassedittext.TransformationMethod = PasswordTransformationMethod.Instance;
renewpasslabel = (TextView)rootview.FindViewById (Resource.Id.resetpassword_renewpasslabel_textview);
renewpasslabel.Text = ResetPasswordScreenData.ReNewPass;
renewpassedittext = (EditText)rootview.FindViewById (Resource.Id.resetpassword_renewpass_edittext);
renewpassedittext.Hint = ResetPasswordScreenData.ReNewPass;
renewpassedittext.InputType = global::Android.Text.InputTypes.TextVariationPassword;
renewpassedittext.TransformationMethod = PasswordTransformationMethod.Instance;
var resethint=(TextView)rootview.FindViewById (Resource.Id.resetpassword_passwordhint_textview);
resethint.Text = ResetPasswordScreenData.ResetHint;
resetbutton = (Button)rootview.FindViewById (Resource.Id.resetpassword_reset_button);
resetbutton.Text = ResetPasswordScreenData.RestPass;
resetbutton.Click-=Onresetpassword;
resetbutton.Click+=Onresetpassword;
// Dictionary<string,string> parameters =new Dictionary<string, string>();
// parameters.Add("token_id",GlobalVariable.token_id);
// App.INSTANCE.networknamager.CheckToken (parameters, (Tap5050WebResponse response) => {
// nn_activity.RunOnUiThread (() => {
// RemoveSpinner (rootview);
// });
// });
// public void InAppResetPassword(Dictionary<string,string> parameters, MsgHandler responsehander){
// if (parameters.ContainsKey ("token_id") && !string.IsNullOrEmpty (parameters ["token_id"])&&
// parameters.ContainsKey ("new_password") && !string.IsNullOrEmpty (parameters ["new_password"])&&
// parameters.ContainsKey ("old_password") && !string.IsNullOrEmpty (parameters ["old_password"])) {
return rootview;
}
示例6: OnCreateView
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
rootview=(RelativeLayout)inflater.Inflate (Resource.Layout.terms, container, false);
backbut =(Button)rootview.FindViewById (Resource.Id.terms_okbut_button);
backbut.Text="Back";
backbut.Click -= OnBackButClick;
backbut.Click += OnBackButClick;
contexttextview = (TextView)rootview.FindViewById (Resource.Id.terms_text_textview);
string content = "";
using (StreamReader sr = new StreamReader (nn_activity.Assets.Open (nn_termsobject.fileName)))
{
content = sr.ReadToEnd ();
}
contexttextview.Text = content;
return rootview;
}
示例7: OnCreateView
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
rootview = (RelativeLayout)inflater.Inflate (Resource.Layout.raffdetail_seeprize, container, false);
WebView myWebView = (WebView)rootview.FindViewById(Resource.Id.webview);
myWebView.Settings.JavaScriptEnabled = true;
myWebView.Settings.LoadWithOverviewMode = true;
myWebView.Settings.UseWideViewPort = true;
myWebView.SetWebViewClient(new GeoWebViewClient());
myWebView.SetWebChromeClient ( new GeoWebChromeClient ());
myWebView.Settings.SetSupportMultipleWindows (true);
myWebView.Settings.JavaScriptCanOpenWindowsAutomatically = true;
myWebView.Settings.SetAppCacheEnabled (true);
myWebView.Settings.DatabaseEnabled = true;
myWebView.Settings.DomStorageEnabled = true;
myWebView.LoadUrl(nn_url);
return rootview;
}
示例8: BottomActionBar
public BottomActionBar(Context context, IAttributeSet attrs)
: base(context, attrs)
{
m_Context = context;
mInflater = (LayoutInflater)context.GetSystemService(Context.LayoutInflaterService);
mBarView = (RelativeLayout)mInflater.Inflate(Resource.Layout.BottomActionBar, null);
AddView(mBarView);
mLogoView = mBarView.FindViewById<ImageView>(Resource.Id.actionbar_home_logo);
mHomeLayout = mBarView.FindViewById<RelativeLayout>(Resource.Id.actionbar_home_bg);
mHomeBtn = mBarView.FindViewById<ImageButton>(Resource.Id.actionbar_home_btn);
mBackIndicator = mBarView.FindViewById(Resource.Id.actionbar_home_is_back);
mTitleView = mBarView.FindViewById<TextView>(Resource.Id.actionbar_title);
mActionsView = mBarView.FindViewById<LinearLayout>(Resource.Id.actionbar_actions);
mTitleLayout = mBarView.FindViewById<RelativeLayout>(Resource.Id.actionbar_title_layout);
mProgress = mBarView.FindViewById<ProgressBar>(Resource.Id.actionbar_progress);
}
示例9: OnCreateView
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
fa = base.Activity;
ll = (RelativeLayout) inflater.Inflate(Resource.Layout.FightIt, container, false);
_gpsTracker = ((AfaApplication)fa.ApplicationContext).GetGpsTracker(fa);
//_loadingDialog = LoadingDialogManager.ShowLoadingDialog (fa);
_crueltySpotsList = ll.FindViewById<ListView>(Resource.Id.CrueltySpots);
_crueltySpotsList.ItemClick += (sender, e) =>
{
var crueltySpot = _crueltySpots[e.Position];
NavigateToCrueltySpotDetails(crueltySpot.ObjectId);
};
_loadingDialog = DialogManager.ShowLoadingDialog(this.Activity, "Retrieving Cruelty Spots");
LoadCrueltySpots();
return ll;
}
示例10: ActionBar
public ActionBar(Context context, IAttributeSet attrs)
: base(context, attrs)
{
m_Context = context;
mInflater = (LayoutInflater)context.GetSystemService(Context.LayoutInflaterService);
mBarView = (RelativeLayout)mInflater.Inflate(Resource.Layout.ActionBar, null);
AddView(mBarView);
mLogoView = mBarView.FindViewById<ImageView>(Resource.Id.actionbar_home_logo);
mHomeLayout = mBarView.FindViewById<RelativeLayout>(Resource.Id.actionbar_home_bg);
mHomeBtn = mBarView.FindViewById<ImageButton>(Resource.Id.actionbar_home_btn);
mBackIndicator = mBarView.FindViewById(Resource.Id.actionbar_home_is_back);
mTitleView = mBarView.FindViewById<TextView>(Resource.Id.actionbar_title);
mActionsView = mBarView.FindViewById<LinearLayout>(Resource.Id.actionbar_actions);
mProgress = mBarView.FindViewById<ProgressBar>(Resource.Id.actionbar_progress);
mTitleLayout = mBarView.FindViewById<RelativeLayout>(Resource.Id.actionbar_title_layout);
TypedArray a = context.ObtainStyledAttributes(attrs,
Resource.Styleable.ActionBar);
m_OverflowAction = new OverflowActionBarAction(context);
string title = a.GetString(Resource.Styleable.ActionBar_title);
//check if pre-honeycomb. Ideally here you would actually want to check if a menu button exists.
//however on all pre-honeycomb phones they basically did.
var currentapiVersion = (int)Build.VERSION.SdkInt;
m_HasMenuButton = currentapiVersion <= 10;
if (title != null)
{
SetTitle(title);
}
a.Recycle();
}
示例11: OnCreateView
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
rootview = (RelativeLayout)inflater.Inflate (Resource.Layout.tutorial_item, container, false);
var imagcontainer = (RelativeLayout)rootview.FindViewById (Resource.Id.tutorial_imagecontainer);
ImageView image = new ImageView (nn_activity);
float height = (TapUtil.SCREEN_WIDTH_DX /515) *658;
RelativeLayout.LayoutParams imgparam=new RelativeLayout.LayoutParams ((int)TapUtil.SCREEN_WIDTH_DX,(int)height);
image.SetScaleType (ImageView.ScaleType.FitXy);
image.LayoutParameters = imgparam;
if(nn_type==0){
switch (nn_position) {
case 0:
image.SetImageResource (Resource.Drawable.Tutorial0_1);
break;
case 1:
image.SetImageResource (Resource.Drawable.Tutorial0_2);
break;
case 2:
image.SetImageResource (Resource.Drawable.Tutorial0_3);
break;
}
}
else if(nn_type==1){
switch (nn_position) {
case 0:
image.SetImageResource (Resource.Drawable.Tutorial1_1);
break;
case 1:
image.SetImageResource (Resource.Drawable.Tutorial1_2);
break;
case 2:
image.SetImageResource (Resource.Drawable.Tutorial1_3);
break;
case 3:
image.SetImageResource (Resource.Drawable.Tutorial1_4);
break;
}
}
else if(nn_type==2){
switch (nn_position) {
case 0:
image.SetImageResource (Resource.Drawable.Tutorial2_1);
break;
case 1:
image.SetImageResource (Resource.Drawable.Tutorial2_2);
break;
case 2:
image.SetImageResource (Resource.Drawable.Tutorial2_3);
break;
case 3:
image.SetImageResource (Resource.Drawable.Tutorial2_4);
break;
}
}
else if(nn_type==3){
switch (nn_position) {
case 0:
image.SetImageResource (Resource.Drawable.Tutorial3_1);
break;
case 1:
image.SetImageResource (Resource.Drawable.Tutorial3_2);
break;
case 2:
image.SetImageResource (Resource.Drawable.Tutorial3_3);
break;
case 3:
image.SetImageResource (Resource.Drawable.Tutorial3_4);
break;
case 4:
image.SetImageResource (Resource.Drawable.Tutorial3_5);
break;
case 5:
image.SetImageResource (Resource.Drawable.Tutorial3_6);
break;
case 6:
image.SetImageResource (Resource.Drawable.Tutorial3_7);
break;
case 7:
image.SetImageResource (Resource.Drawable.Tutorial3_8);
break;
}
}else if(nn_type==4){
switch (nn_position) {
case 0:
image.SetImageResource (Resource.Drawable.Tutorial4_1);
break;
case 1:
image.SetImageResource (Resource.Drawable.Tutorial4_2);
break;
case 2:
image.SetImageResource (Resource.Drawable.Tutorial4_3);
break;
case 3:
image.SetImageResource (Resource.Drawable.Tutorial4_4);
break;
case 4:
//.........这里部分代码省略.........
示例12: OnCreateView
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
rootview = (RelativeLayout)inflater.Inflate (Resource.Layout.raffleroot, container, false);
locationcontainerlayout=(LinearLayout)rootview.FindViewById (Resource.Id.raffleroot_locationcontainer_linerlayout);
locationtextview=(TextView)rootview.FindViewById (Resource.Id.raffleroot_location_textview);
locationtextview.Text += " " + nn_location;
confirmedtab = (Button)rootview.FindViewById (Resource.Id.raffleroot_toptabconfirmed_button);
confirmedtab.Click -= OnConifrmedClick;
confirmedtab.Click += OnConifrmedClick;
potencialtab = (Button)rootview.FindViewById (Resource.Id.raffleroot_toptabpotencial_button);
potencialtab.Click -= OnPotencialClick;
potencialtab.Click += OnPotencialClick;
confirmedtabindicator = (RelativeLayout)rootview.FindViewById (Resource.Id.raffleroot_toptabconfirmedindicator_relativelayout);
potencialtabindicator = (RelativeLayout)rootview.FindViewById (Resource.Id.raffleroot_toptabpotencialindicator_relativelayout);
if (showconfirmed) {
confirmedtab.SetTextColor (Resources.GetColor(Resource.Color.iosblue));
potencialtab.SetTextColor (Resources.GetColor(Resource.Color.black));
confirmedtabindicator.SetBackgroundResource (Resource.Color.iosblue);
potencialtabindicator.SetBackgroundResource (Resource.Color.light_gray);
} else {
confirmedtab.SetTextColor (Resources.GetColor(Resource.Color.black));
potencialtab.SetTextColor (Resources.GetColor(Resource.Color.iosblue));
confirmedtabindicator.SetBackgroundResource (Resource.Color.light_gray);
potencialtabindicator.SetBackgroundResource (Resource.Color.iosblue);
}
// TextView locationtext=new TextView(nn_activity);
// locationtext.SetTextColor (Color.Gray);
// locationtext.Text=nn_location;
// LinearLayout.LayoutParams param=new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WrapContent,LinearLayout.LayoutParams.WrapContent);
// param.Gravity=global::Android.Views.GravityFlags.Center;
// param.LeftMargin=TapUtil.dptodx(5);
// locationtext.LayoutParameters=param;
// locationcontainerlayout.AddView (locationtext);
//initialize listview
listview=(ListView)rootview.FindViewById(Resource.Id.raffleroot_eventlist_listview);
listview.Divider = null;
adapter = new EventListAdapter (nn_activity,confirmedcards);
listview.Adapter = adapter;
//adapter.NotifyListChange ();
listview.ItemClick+= (object sender, AdapterView.ItemClickEventArgs e) => {
if(showconfirmed){
(nn_activity as HomeScreen).ShowRaffleDetailFragment(confirmedcards[e.Position]);
//(nn_activity as HomeScreen).ShowRaffleDetailFragment(confirmedcards,e.Position,0);
}
else{
(nn_activity as HomeScreen).ShowRaffleDetailFragment(potencialcards[e.Position]);
//(nn_activity as HomeScreen).ShowRaffleDetailFragment(potencialcards,e.Position,1);
}
};
return rootview;
}
示例13: Initialize
private void Initialize()
{
mFlipAnimation = new RotateAnimation(0, -180,
Android.Views.Animations.Dimension.RelativeToSelf, 0.5f,
Android.Views.Animations.Dimension.RelativeToSelf, 0.5f);
mFlipAnimation.Interpolator = new LinearInterpolator();
mFlipAnimation.Duration = 250;
mFlipAnimation.FillAfter = true;
mReverseFlipAnimation = new RotateAnimation(-180, 0,
Android.Views.Animations.Dimension.RelativeToSelf, 0.5f,
Android.Views.Animations.Dimension.RelativeToSelf, 0.5f);
mReverseFlipAnimation.Interpolator = new LinearInterpolator();
mReverseFlipAnimation.Duration = 250;
mReverseFlipAnimation.FillAfter = true;
mInflater = Context.GetSystemService(Context.LayoutInflaterService) as LayoutInflater;
mRefreshView = (RelativeLayout)mInflater.Inflate(Resource.Layout.pull_to_refresh_header, this, false);
mRefreshViewText =
(TextView)mRefreshView.FindViewById(Resource.Id.pull_to_refresh_text);
mRefreshViewImage =
(ImageView)mRefreshView.FindViewById(Resource.Id.pull_to_refresh_image);
mRefreshViewProgress =
(ProgressBar)mRefreshView.FindViewById(Resource.Id.pull_to_refresh_progress);
mRefreshViewLastUpdated =
(TextView)mRefreshView.FindViewById(Resource.Id.pull_to_refresh_updated_at);
mRefreshViewImage.SetMinimumHeight(50);
mRefreshView.SetOnClickListener(new OnClickRefreshListener(this));
mRefreshOriginalTopPadding = mRefreshView.PaddingTop;
mRefreshState = TAP_TO_REFRESH;
AddHeaderView(mRefreshView);
base.SetOnScrollListener(this);
MeasureView(mRefreshView);
mRefreshViewHeight = mRefreshView.MeasuredHeight;
}
示例14: OnCreateView
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
fa = base.Activity;
ll = (RelativeLayout)inflater.Inflate(Resource.Layout.ReportCruelty, container, false);
//CrueltyNavMenuHelper.InitCrueltyNavMenu (this, CrueltyNavMenuItem.ReportIt);
_crueltyReport = ((AfaApplication)fa.ApplicationContext).CrueltyReport;
if (_crueltyReport == null)
{
_crueltyReport = new CrueltyReport();
((AfaApplication)fa.ApplicationContext).CrueltyReport = _crueltyReport;
}
_locationInput = ll.FindViewById<EditText>(Resource.Id.LocationInput);
_crueltyTypeInput = ll.FindViewById<EditText>(Resource.Id.TypeOfCrueltyInput);
if (_crueltyReport.PlaceSpecified)
{
var locationText = new StringBuilder();
locationText.Append("<font color='#D34C96'><b>");
locationText.Append(_crueltyReport.PlaceName);
locationText.Append("</b></font>");
locationText.Append("<br />");
locationText.Append("<font color='#B5B5B5'><small>");
locationText.Append(_crueltyReport.PlaceFormattedShortAddress);
locationText.Append("</small></font>");
var htmlText = locationText.ToString();
_locationInput.SetText(Html.FromHtml(htmlText), TextView.BufferType.Spannable);
}
_crueltyTypeInput.Text = _crueltyReport.CrueltyType != null ? _crueltyReport.CrueltyType.Name : null;
//_locationInput.FocusChange += (sender, args) =>
//{
// if (args.HasFocus) {
// var intent = new Intent (fa, typeof(NearbyPlacesActivity));
// StartActivity (intent);
// }
//};
_locationInput.Click += (sender, args) =>
{
var intent = new Intent(fa, typeof(NearbyPlacesActivity));
StartActivity(intent);
};
//_crueltyTypeInput.FocusChange += (sender, args) =>
//{
// if (args.HasFocus) {
// var intent = new Intent (fa, typeof(CrueltyTypesActivity));
// StartActivity (intent);
// }
//};
_crueltyTypeInput.Click += (sender, args) =>
{
var intent = new Intent(fa, typeof(CrueltyTypesActivity));
StartActivity(intent);
};
//// ToDo: This line hides the soft keyboard, but doing so makes the EditText only have 1 line.
//// Look into alternative
////_locationInput.InputType = InputTypes.Null;
//_crueltyTypeInput.InputType = InputTypes.Null;
_submitButton = ll.FindViewById<Button>(Resource.Id.SubmitButton);
_submitButton.Enabled = _crueltyReport.PlaceSpecified && _crueltyReport.CrueltyTypeSpecified;
_submitButton.Click +=
(sender, args) =>
{
// Create a new Cruelty Spot
_loadingDialog = DialogManager.ShowSubmittingDialog(fa);
//CrueltySpotDto newCrueltySpot;
CrueltySpot newCrueltySpot;
if (_crueltyReport.IsGooglePlace())
{
// Fetch details from google
var googlePlaces = new GooglePlacesApi.GooglePlaces(AfaConfig.GoogleApiKey);
googlePlaces.GetDetails(_crueltyReport.GooglePlace.Reference, response =>
{
// ToDo: Check Status and handle non-OK
var placeDetails = response.result;
var latitude = placeDetails.geometry.location.lat;
var longitude = placeDetails.geometry.location.lng;
newCrueltySpot = new CrueltySpot
{
Name = placeDetails.name,
//Description = _descriptionInput.Text,
Address = placeDetails.Address,
City = placeDetails.City,
StateProvinceAbbreviation = placeDetails.StateOrProvince,
Zipcode = placeDetails.PostalCode,
PhoneNumber = placeDetails.formatted_phone_number,
WebpageUrl = placeDetails.website,
//Latitude = placeDetails.geometry.location.lat,
//Longitude = placeDetails.geometry.location.lng,
//.........这里部分代码省略.........
示例15: LegacyBar
public LegacyBar(Context context, IAttributeSet attrs)
: base(context, attrs)
{
ResourceIdManager.UpdateIdValues();
_inflater = LayoutInflater.From(Context);
//_inflater = (LayoutInflater)context.GetSystemService(Context.LayoutInflaterService);
_barView = (RelativeLayout)_inflater.Inflate(Resource.Layout.actionbar, null);
AddView(_barView);
_logoView = _barView.FindViewById(Resource.Id.actionbar_home_logo) as ImageView;
_homeLayout = _barView.FindViewById<RelativeLayout>(Resource.Id.actionbar_home_bg);
_homeBtn = _barView.FindViewById<ImageButton>(Resource.Id.actionbar_home_btn);
_backIndicator = _barView.FindViewById(Resource.Id.actionbar_home_is_back);
_titleView = _barView.FindViewById<TextView>(Resource.Id.actionbar_title);
_actionsView = _barView.FindViewById<LinearLayout>(Resource.Id.actionbar_actions);
_progress = _barView.FindViewById<ProgressBar>(Resource.Id.actionbar_progress);
_titleLayout = _barView.FindViewById<RelativeLayout>(Resource.Id.actionbar_title_layout);
_titleDropdown = _barView.FindViewById<Spinner>(Resource.Id.actionbar_spinner);
_overflowLegacyBarAction = new OverflowLegacyBarAction(Context);
//Custom Attributes (defined in Attrs.xml)
var a = Context.ObtainStyledAttributes(attrs,
Resource.Styleable.actionbar);
//grab theme attributes
Theme = (LegacyBarTheme)a.GetInt(Resource.Styleable.actionbar_theme, 0);
IsBottom = a.GetBoolean(Resource.Styleable.actionbar_is_bottom, false);
LightIcons = a.GetBoolean(Resource.Styleable.actionbar_light_icons, false);
//if we are not custom don't let them set it.
if (Theme != LegacyBarTheme.Custom)
{
LightIcons = Theme == LegacyBarTheme.HoloLight;
}
_overflowLegacyBarAction.SetIconColor(LightIcons);
var title = a.GetString(Resource.Styleable.actionbar_title);
if (null != title)
Title = title;
var titleColor = a.GetColor(Resource.Styleable.actionbar_title_color, Resources.GetColor(Resource.Color.actionbar_title));
TitleColor = titleColor;
var separatorColor = a.GetColor(Resource.Styleable.actionbar_separator, Resources.GetColor(Resource.Color.actionbar_separator));
_actionsView.SetBackgroundColor(separatorColor);
_homeLayout.SetBackgroundColor(separatorColor);
using (var background = a.GetDrawable(Resource.Styleable.actionbar_background)) //recycling the drawable immediately
{
if (null != background)
BackgroundDrawable = background;
}
var backgroundItem = a.GetDrawable(Resource.Styleable.actionbar_background_item);
if (null != backgroundItem)
ItemBackgroundDrawable = backgroundItem;
if (IsBottom)
{
LegacyBarUtils.SetBottomLegacyBarTheme(this, Theme);
}
else
{
LegacyBarUtils.SetLegacyBarTheme(this, Theme);
}
a.Recycle();
_titleView.Click += (s, e) => { if (null != TitleClick) TitleClick(s, e); };
_titleView.LongClick += (s, e) => { if (null != TitleLongClick) TitleLongClick(s, e); };
}