本文整理汇总了C#中RelativeLayout.SetBackgroundResource方法的典型用法代码示例。如果您正苦于以下问题:C# RelativeLayout.SetBackgroundResource方法的具体用法?C# RelativeLayout.SetBackgroundResource怎么用?C# RelativeLayout.SetBackgroundResource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RelativeLayout
的用法示例。
在下文中一共展示了RelativeLayout.SetBackgroundResource方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnCreateView
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
base.OnCreateView (inflater, container, savedInstanceState);
// Save ScreenController for later use
ctrl = ((GameController)this.Activity);
if (container == null)
return null;
var view = inflater.Inflate(Resource.Layout.GameListScreen, container, false);
// Don't know a better way :(
_layoutBottom = view.FindViewById<RelativeLayout> (Resource.Id.layoutBottom);
_layoutBottom.SetBackgroundResource(Main.BottomBackground);
// Get views
_textLatitude = view.FindViewById<TextView>(Resource.Id.textLatitude);
_textLongitude = view.FindViewById<TextView>(Resource.Id.textLongitude);
_textAltitude = view.FindViewById<TextView>(Resource.Id.textAltitude);
_textAccuracy = view.FindViewById<TextView>(Resource.Id.textAccuracy);
_imageAltitude = view.FindViewById<ImageView>(Resource.Id.imageAltitude);
_imageAccuracy = view.FindViewById<ImageView>(Resource.Id.imageAccuracy);
// Create list adapter and list events
_listView = view.FindViewById<ListView> (Resource.Id.listView);
_listView.Adapter = new GameListScreenAdapter (this, ctrl, type);
_listView.ItemClick += OnItemClick;
_listView.Recycler += OnRecycling;
ctrl.SupportActionBar.Title = GetContent ();
HasOptionsMenu = (type == ScreenTypes.Locations || type == ScreenTypes.Items);
_refresh.Abort();
RefreshLocation();
return view;
}
示例2: OnCreateView
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
rootview = new RelativeLayout (nn_activity);
rootview.LayoutParameters = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.MatchParent);
rootview.SetBackgroundColor (Resources.GetColor(Resource.Color.soarnix_bg_gray));
rootview.Id = TapUtil.generateViewId ();
//list to show event history
historyeventlist = new ListView (nn_activity);
historyeventlist.LayoutParameters= new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.MatchParent);
historyeventlist.Id = TapUtil.generateViewId ();
adapter = new EventHistoryListAdapter (nn_activity,historylist);
historyeventlist.Adapter = adapter;
//add a relative layout to rootview to show no result event
nohistorylayout=new RelativeLayout(nn_activity);
nohistorylayout.LayoutParameters= new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.MatchParent);
nohistorylayout.SetBackgroundResource(Resource.Color.soarnix_bg_gray);
nohistorylayout.Visibility = ViewStates.Gone;
nohistorytext = new TextView (nn_activity);
nohistorytext.Text = HistoryScreenData.NoRecordMessage;
nohistorytext.Gravity = GravityFlags.Center;
RelativeLayout.LayoutParams nohistorytextparam=new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
nohistorytextparam.AddRule (LayoutRules.CenterInParent);
nohistorytextparam.SetMargins (TapUtil.dptodx (10), 0, TapUtil.dptodx (10), 0);
nohistorytext.LayoutParameters = nohistorytextparam;
nohistorylayout.AddView (nohistorytext);
rootview.AddView (historyeventlist);
rootview.AddView (nohistorylayout);
return rootview;
}
示例3: 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;
}
示例4: OnCreateView
/// <summary>
/// Raised, when view of this fragment should be created.
/// </summary>
/// <param name="bundle">Bundle with cartridge and restore flag.</param>
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
base.OnCreateView(inflater, container, savedInstanceState);
// Save ScreenController for later use
ctrl = ((GameController)this.Activity);
// Set images for icons
_iconLocation = BitmapFactory.DecodeResource(ctrl.Resources, Resource.Drawable.ic_locations);
_iconYouSee = BitmapFactory.DecodeResource(ctrl.Resources, Resource.Drawable.ic_yousee);
_iconInventory = BitmapFactory.DecodeResource(ctrl.Resources, Resource.Drawable.ic_inventory);
_iconTask = BitmapFactory.DecodeResource(ctrl.Resources, Resource.Drawable.ic_tasks);
_iconPosition = BitmapFactory.DecodeResource(ctrl.Resources, Resource.Drawable.ic_position);
// Load layout
var view = inflater.Inflate(Resource.Layout.GameMainScreen, container, false);
// Don't know a better way :(
_layoutBottom = view.FindViewById<RelativeLayout> (Resource.Id.layoutBottom);
_layoutBottom.SetBackgroundResource(Main.BottomBackground);
// Get views
_textLatitude = view.FindViewById<TextView>(Resource.Id.textLatitude);
_textLongitude = view.FindViewById<TextView>(Resource.Id.textLongitude);
_textAltitude = view.FindViewById<TextView>(Resource.Id.textAltitude);
_textAccuracy = view.FindViewById<TextView>(Resource.Id.textAccuracy);
_imageAltitude = view.FindViewById<ImageView>(Resource.Id.imageAltitude);
_imageAccuracy = view.FindViewById<ImageView>(Resource.Id.imageAccuracy);
// Create list adapter and list events
_listView = view.FindViewById<ListView>(Resource.Id.listView);
_listView.Adapter = new GameMainScreenAdapter(this, ctrl);
_listView.ItemClick += OnItemClick;
RefreshLocation();
return view;
}
示例5: OnCreateView
//.........这里部分代码省略.........
} else {
boardcardlist.Add (new TeamLeaderBoardCard (eventcard.eventinfo.groupLeaderBoardList[i], 2));
}
}
leaderboardadapter = new LeaderBoardAdapter (nn_activity, boardcardlist, selfcard, true);
}else {
leaderboardadapter = new LeaderBoardAdapter (nn_activity, new List<TeamLeaderBoardCard> (), new LeaderBoardSelfCard("0","0"),true);
}
//GET CONTAINER
goalscontainer=(RelativeLayout)view.FindViewById (Resource.Id.raffledetail_goalsbodycontainer_relativelayout);
goalscontainer.Visibility = ViewStates.Invisible;
//goalscontainer.SetBackgroundResource(Resource.Drawable.bg_relativelayout_grayround);
RelativeLayout slideritemcontainer = new RelativeLayout (nn_activity);
slideritemcontainer.LayoutParameters=new RelativeLayout.LayoutParams ( RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.WrapContent);
//slideritemcontainer.SetPadding (TapUtil.dptodx(30),TapUtil.dptodx(10),TapUtil.dptodx(30),TapUtil.dptodx(10));
try{
DateTime eventEndTime=DateTime.ParseExact (eventcard.eventinfo.event_end_time.Substring (0, 19),
"yyyy-MM-ddTHH:mm:ss", null);
hours=(eventEndTime-DateTime.Now).TotalHours;
}
catch{
hours = 0;
}
daybartextview = new TextView (nn_activity);
int leftday = (int)hours / 24;
int lefthours = (int)hours % 24;
daybartextview.Text = string.Format (" "+leftday+" Days,"+" "+lefthours+" Hours");
daybartextview.Gravity = GravityFlags.Center;
daybartextview.Typeface = Typeface.DefaultBold;
daybartextview.SetBackgroundResource(Resource.Color.iosblue);
daybartextview.TextSize = TapUtil.dptodx (8);
daybartextview.SetTextColor (Color.White);
daybartextview.Id = TapUtil.generateViewId ();
RelativeLayout.LayoutParams daybartextviewparam=new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.WrapContent);
daybartextviewparam.TopMargin=TapUtil.dptodx (10);
daybartextviewparam.LeftMargin=TapUtil.dptodx (5);
daybartextviewparam.RightMargin=TapUtil.dptodx (5);
daybartextview.LayoutParameters = daybartextviewparam;
slideritemcontainer.AddView (daybartextview);
circlepanelrealtivelayout = new RelativeLayout (nn_activity);
//circlepanelrealtivelayout.SetBackgroundResource (Resource.Drawable.bg_relativelayout_grayround);
circlepanelrealtivelayout.Id = TapUtil.generateViewId ();
RelativeLayout.LayoutParams circlepanelparam=new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.WrapContent);
//circlepanelparam.TopMargin=TapUtil.dptodx(20);
circlepanelparam.AddRule (LayoutRules.Below, daybartextview.Id);
circlepanelrealtivelayout.LayoutParameters= circlepanelparam;
circlepanelrealtivelayout.SetPadding (TapUtil.dptodx (5), TapUtil.dptodx (5), TapUtil.dptodx (5), TapUtil.dptodx (5));
personalprogresslabel = new TextView (nn_activity);
personalprogresslabel.Text=GoalScreenData.personalProgressLabelText;
RelativeLayout.LayoutParams personalprogresslabelparam=new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.WrapContent);
personalprogresslabel.LayoutParameters = personalprogresslabelparam;
personalprogresslabel.Gravity = GravityFlags.Center;
personalprogresslabel.Typeface = Typeface.DefaultBold;
personalprogresslabel.Id = TapUtil.generateViewId ();
goalslinearlayout = new LinearLayout (nn_activity);
RelativeLayout.LayoutParams goalslayoutparam=new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.WrapContent);
goalslayoutparam.AddRule (LayoutRules.Below, personalprogresslabel.Id);
goalslayoutparam.TopMargin = TapUtil.dptodx (10);
示例6: OnCreateView
//.........这里部分代码省略.........
headerlinearlayout.AddView (eventnametextview);
headerlinearlayout.AddView (organizationnametextview);
headercontainer.AddView (eventimagview);
headercontainer.AddView (headerlinearlayout);
pagecontainder.AddView (headercontainer);
scrollerview = new ScrollView (nn_activity);
RelativeLayout.LayoutParams scollviewparam=new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.MatchParent);
scollviewparam.AddRule (LayoutRules.Below, headercontainer.Id);
scollviewparam.TopMargin = TapUtil.dptodx (20);
scrollerview.LayoutParameters = scollviewparam;
RelativeLayout slideritemcontainer = new RelativeLayout (nn_activity);
slideritemcontainer.LayoutParameters=new ScrollView.LayoutParams ( ScrollView.LayoutParams.MatchParent,ScrollView.LayoutParams.WrapContent);
slideritemcontainer.SetPadding (TapUtil.dptodx(30),TapUtil.dptodx(10),TapUtil.dptodx(30),TapUtil.dptodx(10));
try{
DateTime eventEndTime=DateTime.ParseExact (nn_goalcard.eventinfo.event_end_time.Substring (0, 19),
"yyyy-MM-ddTHH:mm:ss", null);
hours=(eventEndTime-DateTime.Now).TotalHours;
}
catch{
hours = 0;
}
daybartextview = new TextView (nn_activity);
int leftday = (int)hours / 24;
int lefthours = (int)hours % 24;
daybartextview.Text = string.Format (" "+leftday+" Days,"+" "+lefthours+" Hours");
daybartextview.Gravity = GravityFlags.Center;
daybartextview.Typeface = Typeface.DefaultBold;
daybartextview.SetBackgroundResource(Resource.Color.iosblue);
daybartextview.TextSize = TapUtil.dptodx (8);
daybartextview.SetTextColor (Color.White);
daybartextview.Id = TapUtil.generateViewId ();
RelativeLayout.LayoutParams daybartextviewparam=new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.WrapContent);
daybartextview.LayoutParameters = daybartextviewparam;
slideritemcontainer.AddView (daybartextview);
circlepanelrealtivelayout = new RelativeLayout (nn_activity);
circlepanelrealtivelayout.SetBackgroundResource (Resource.Drawable.bg_relativelayout_grayround);
circlepanelrealtivelayout.Id = TapUtil.generateViewId ();
RelativeLayout.LayoutParams circlepanelparam=new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.WrapContent);
circlepanelparam.TopMargin=TapUtil.dptodx(20);
circlepanelparam.AddRule (LayoutRules.Below, daybartextview.Id);
circlepanelrealtivelayout.LayoutParameters= circlepanelparam;
circlepanelrealtivelayout.SetPadding (TapUtil.dptodx (5), TapUtil.dptodx (5), TapUtil.dptodx (5), TapUtil.dptodx (5));
personalprogresslabel = new TextView (nn_activity);
personalprogresslabel.Text=GoalScreenData.personalProgressLabelText;
RelativeLayout.LayoutParams personalprogresslabelparam=new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.WrapContent);
personalprogresslabel.LayoutParameters = personalprogresslabelparam;
personalprogresslabel.Gravity = GravityFlags.Center;
personalprogresslabel.Typeface = Typeface.DefaultBold;
personalprogresslabel.Id = TapUtil.generateViewId ();
goalslinearlayout = new LinearLayout (nn_activity);
RelativeLayout.LayoutParams goalslayoutparam=new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.WrapContent);
goalslayoutparam.AddRule (LayoutRules.Below, personalprogresslabel.Id);
goalslayoutparam.TopMargin = TapUtil.dptodx (10);
goalslinearlayout.LayoutParameters = goalslayoutparam;
goalslinearlayout.Orientation = Orientation.Horizontal;
goalslinearlayout.Id = TapUtil.generateViewId ();
示例7: OnCreateView
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
string deviceid = TapUtil.GetDeviceID ();
ScrollView rootscroller = new ScrollView (nn_activity);
rootscroller.LayoutParameters = new ViewGroup.LayoutParams (ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
rootscroller.SetBackgroundResource (Resource.Color.soarnix_bg_gray);
RelativeLayout relativelayout = new RelativeLayout (nn_activity);
RelativeLayout.LayoutParams relativelayoutparam=new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.MatchParent);
relativelayout.LayoutParameters=relativelayoutparam;
relativelayout.SetPadding(TapUtil.dptodx (5), TapUtil.dptodx (5), TapUtil.dptodx (5), TapUtil.dptodx (5));
relativelayout.SetBackgroundResource (Resource.Color.soarnix_bg_gray);
//raffle request Card
LayoutInflater inflator = LayoutInflater.From (nn_activity);
LinearLayout noeventcard = (LinearLayout)inflator.Inflate (Resource.Layout.raffleroot_noeventcard, null);
RelativeLayout.LayoutParams noeventcardreparam=new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.WrapContent);
noeventcard.LayoutParameters=noeventcardreparam;
noeventcard.Id = TapUtil.generateViewId ();
TextView hinttextview=(TextView)noeventcard.FindViewById(Resource.Id.rafflenoevent_hint_textview);
hinttextview.Text=AboutScreenData.AboutnoraffleLabel;
EditText charityinput=(EditText)noeventcard.FindViewById(Resource.Id.rafflenoevent_charityinput_edittext);
charityinput.Hint=RaffleListScreenData.organizationNameTextFieldPlaceholder;
EditText numberinput=(EditText)noeventcard.FindViewById(Resource.Id.rafflenoevent_phonenumber_edittext);
numberinput.Hint=RaffleListScreenData.phoneNumberTextFieldPlaceholder;
Button chritysubmitbutton=(Button)noeventcard.FindViewById(Resource.Id.rafflenoevent_charitysubmit_button);
chritysubmitbutton.Text=RaffleListScreenData.sentBtnTitle;
chritysubmitbutton.Click+= (object sender, EventArgs e) => {
//set flags
FormatCheckFlagObject[] flags=new FormatCheckFlagObject[2];
for(int i=0;i<flags.Length;i++){
string message="";
if(i==0){
message=AboutScreenData.organizationNameTextFieldPlaceholder;
}
if(i==1){
message=AboutScreenData.phoneNumberTextFieldPlaceholder;
}
flags[i]=new FormatCheckFlagObject(message);
}
//
if(FormatManager.chechinput(charityinput.Text,FormatManager.FormatOption.OnlyLetter)){
flags[0].flag=true;
}
if(FormatManager.chechinput(numberinput.Text,FormatManager.FormatOption.Phone)){
flags[1].flag=true;
}
bool totalfalg=true;
foreach(var flagobj in flags){
if(!flagobj.flag){
totalfalg=false;
}
}
if(totalfalg){
SocialShareAndroid.Email (string.Format(RaffleListScreenData.RequestRaffleEmailBody,GlobalVariable.username,GlobalVariable.currentlocation,charityinput.Text,numberinput.Text),RaffleListScreenData.RequestRaffleEmailSubject,new string[]{RaffleListScreenData.RequestRaffleEmailTarget});
}
else{
string message="Please check:\n";
for(int i=0;i<flags.Length;i++){
if(flags[i].flag==false){
if(i!=flags.Length-1){
message+=flags[i].message+",";
}else{
message+=flags[i].message;
}
}
}
nn_activity.ShowCustomAlterDialogFragment(AboutScreenData.AlertScreenFormatErrorTitle,message,GlobalScreenData.DefaultPositive,null,"invalidedialog.raffleroot.noeventinput");
}
// if(FormatManager.chechinput(numberinput.Text,FormatManager.FormatOption.Phone)&&FormatManager.chechinput(numberinput.Text,FormatManager.FormatOption.Regular)&&FormatManager.chechinput(charityinput.Text,FormatManager.FormatOption.Regular)){
// SocialShareAndroid.Email (string.Format(RaffleListScreenData.RequestRaffleEmailBody,GlobalVariable.username,GlobalVariable.currentlocation,charityinput.Text,numberinput.Text),RaffleListScreenData.RequestRaffleEmailSubject,new string[]{RaffleListScreenData.RequestRaffleEmailTarget});
// }
// else if(!FormatManager.chechinput(numberinput.Text,FormatManager.FormatOption.Regular)||!FormatManager.chechinput(charityinput.Text,FormatManager.FormatOption.Regular)){
// nn_activity.ShowCustomAlterDialogFragment("Both input can not be empty",GlobalScreenData.DefaultPositive,null,"invalidedialog.raffleroot.noeventinput");
// }
// else if (!FormatManager.chechinput(numberinput.Text,FormatManager.FormatOption.Phone)){
// nn_activity.ShowCustomAlterDialogFragment("Please check format of your phone number",GlobalScreenData.DefaultPositive,null,"invalidedialog.raffleroot.noeventcardnumber");
// }
};
relativelayout.AddView (noeventcard);
//tutorial card
RelativeLayout tutorialcard = new RelativeLayout(nn_activity);
RelativeLayout.LayoutParams tutorialcardparam=new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.WrapContent);
tutorialcardparam.AddRule (LayoutRules.Below,noeventcard.Id);
tutorialcardparam.TopMargin = TapUtil.dptodx(10);
tutorialcard.LayoutParameters=tutorialcardparam;
tutorialcard.Id = TapUtil.generateViewId ();
tutorialcard.SetBackgroundResource (Resource.Drawable.bg_relativelayout_grayround);
tutorialcard.SetPadding(TapUtil.dptodx (20), TapUtil.dptodx (20), TapUtil.dptodx (20), TapUtil.dptodx (20));
//tutorial label
//.........这里部分代码省略.........
示例8: 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;
}
示例9: RefreshRout
void RefreshRout()
{
llContent.RemoveAllViews ();
RelativeLayout rl = null;
RelativeLayout.LayoutParams rlParams = null;
for (int d = 0; d < rout.Items.Count; d++ ) {
var item = rout.Items[d];
LinearLayout ll = new LinearLayout (Activity);
LinearLayout.LayoutParams param = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent, 1);
param.SetMargins (5, 0, 5, 0);
ll.LayoutParameters = param;
ll.Orientation = Orientation.Vertical;
rl = new RelativeLayout (Activity);
rl.LayoutParameters = new LinearLayout.LayoutParams (ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent, 1);
rl.SetBackgroundResource (Resource.Drawable.bottomline);
TextView head = new TextView (Activity);
var culture = new System.Globalization.CultureInfo("ru-RU");
// var day = ;
head.Text = UppercaseFirst(culture.DateTimeFormat.GetDayName(item.DayOfWeek));
head.SetTextAppearance (Activity, Resource.Style.headerTextForRout);
// head.LayoutParameters = new LinearLayout.LayoutParams (ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent, 1);
rlParams = new RelativeLayout.LayoutParams (ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);
rlParams.AddRule (LayoutRules.CenterInParent);
head.LayoutParameters = rlParams;
rl.AddView (head);
ll.AddView (rl);
// TextView height = new TextView (Activity);
// height.Text = ().ToString();
// height.LayoutParameters = new LinearLayout.LayoutParams (ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent, 1);
// ll.AddView (height);
// TextView width = new TextView (Activity);
// width.Text = ().ToString();
// width.LayoutParameters = new LinearLayout.LayoutParams (ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent, 1);
// ll.AddView (width);
for (int i = 0; i < Rout.PHARMACIES_COUNT; i++) {
rl = new RelativeLayout (Activity);
rl.LayoutParameters = new LinearLayout.LayoutParams (ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent, 2);
rl.SetBackgroundResource (Resource.Drawable.bottomline);
rl.Click += Rl_Click;
rlParams = new RelativeLayout.LayoutParams (ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);
rlParams.AddRule (LayoutRules.CenterInParent);
if (rout.Items [d].Pharmacies [i] == 0) {
ImageView imgEmpty = new ImageView (Activity);
imgEmpty.SetImageResource (Resource.Drawable.ic_add_circle_outline_black_24dp);
imgEmpty.LayoutParameters = rlParams;
rl.AddView (imgEmpty);
} else {
// p.LayoutParameters = new LinearLayout.LayoutParams (ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent, 1);
//p.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WrapContent,
// pharmacy.Draw
TextView tvPharmacy = new TextView (Activity);
tvPharmacy.Text = PharmacyManager.GetPharmacy(rout.Items [d].Pharmacies [i]).fullName;
tvPharmacy.SetTextAppearance (Activity, Resource.Style.rowTextForPharmacy);
tvPharmacy.LayoutParameters = rlParams;
rl.AddView (tvPharmacy);
}
rl.Id = i;
ll.AddView (rl);
}
ll.Id = d;
llContent.AddView (ll);
}
}