本文整理汇总了C#中RelativeLayout.SetPadding方法的典型用法代码示例。如果您正苦于以下问题:C# RelativeLayout.SetPadding方法的具体用法?C# RelativeLayout.SetPadding怎么用?C# RelativeLayout.SetPadding使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RelativeLayout
的用法示例。
在下文中一共展示了RelativeLayout.SetPadding方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddItem
//here we only have img and text for each item
//create a RelativeLayout and add it to dic
//squear image
public void AddItem(int imgresource,string text,Action OnCellClick)
{
RelativeLayout menucell = new RelativeLayout (nn_context);
menucell.SetPadding (TapUtil.dptodx(padding),TapUtil.dptodx(padding),TapUtil.dptodx(padding),TapUtil.dptodx(padding));
menucell.LayoutParameters = new LinearLayout.LayoutParams (TapUtil.dptodx(cellwidth),TapUtil.dptodx(cellheight));
menucell.Click+= (object sender, EventArgs e) => {
if(OnCellClick!=null){
OnCellClick();
}
};
ImageView img = new ImageView (nn_context);
img.Id = TapUtil.generateViewId ();
img.LayoutParameters = new RelativeLayout.LayoutParams (TapUtil.dptodx(imagewidth),TapUtil.dptodx(imagewidth));
// Bitmap.CreateScaledBitmap(imgresource, TapUtil.dptodx(imagewidth), TapUtil.dptodx(imageheight), false);
img.SetImageResource (imgresource);
img.SetBackgroundColor (Color.White);
TextView textview = new TextView (nn_context);
RelativeLayout.LayoutParams textviewparam=new RelativeLayout.LayoutParams (TapUtil.dptodx(textwidth),TapUtil.dptodx(textheight));
textviewparam.AddRule(LayoutRules.RightOf,img.Id);
textviewparam.LeftMargin = TapUtil.dptodx (space);
textview.LayoutParameters =textviewparam;
textview.Text = text;
textview.SetTypeface (Typeface.Default, TypefaceStyle.Bold);
textview.SetTextColor(Color.Black);
textview.Gravity = global::Android.Views.GravityFlags.Center;
menucell.AddView (img);
menucell.AddView (textview);
nn_itemlist.Add (menucell);
}
示例2: ini2
public void ini2(){
mainLayout = new RelativeLayout (context);
mainLayout.LayoutParameters = new RelativeLayout.LayoutParams (-1,-1);
int padW = Configuration.getWidth(30);
int padH = Configuration.getHeight (5);
mainLayout.SetPadding (padW,padH,padW,padH);
contentLinearLayout = new LinearLayout (context);
contentLinearLayout.LayoutParameters = new LinearLayout.LayoutParams (-1, -2);
contentLinearLayout.Orientation = Orientation.Vertical;
imHeader = new ImageView (context);
titleHeader = new TextView (context);
AutorHeader = new TextView (context);
content = new TextView (context);
titleHeader.LayoutParameters = new LinearLayout.LayoutParams (-2, -2);
AutorHeader.LayoutParameters = new LinearLayout.LayoutParams (-2, -2);
content.LayoutParameters = new LinearLayout.LayoutParams (-2, -2);
titleHeader.SetTextSize (ComplexUnitType.Fraction, Configuration.getHeight(38));
//titleHeader.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/ArcherMediumPro.otf");
content.SetTextSize (ComplexUnitType.Fraction, Configuration.getHeight(32));
//content.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/ArcherMediumPro.otf");
contentLinearLayout.AddView (titleHeader);
contentLinearLayout.AddView (imHeader);
contentLinearLayout.AddView (content);
//titleHeader.SetBackgroundColor (Color.Red);
//imHeader.SetBackgroundResource (Color.Green);
//content.SetBackgroundColor (Color.Blue);
mainLayout.AddView (contentLinearLayout);
}
示例3: ini
public void ini(){
var textFormat = Android.Util.ComplexUnitType.Px;
mainLayout = new RelativeLayout (context);
mainLayout.LayoutParameters = new RelativeLayout.LayoutParams (-1,-1);
contenLayout = new LinearLayout (context);
contenLayout.LayoutParameters = new LinearLayout.LayoutParams (-2, -2);
contenLayout.Orientation = Orientation.Vertical;
titleHeader = new TextView (context);
content = new TextView (context);
titleHeader.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf");
content.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf");
//titleHeader.Text = "El Perú cuenta con mas de 357000 tipos de aves";
titleHeader.SetTypeface(null,TypefaceStyle.Bold);
titleHeader.SetTextSize (textFormat, Configuration.getHeight (52));
titleHeader.SetMaxWidth (Configuration.getWidth (583));
//content.Text = "Los factores geográficos, climáticos y evolutivos convierten al Perú en el mejor lugar para realizar la observacion de aves(birthwaching) Tiene 1830 especies de pájaros(segun la lista oficial del SACC/CRAP), tambien es considerado el";
content.SetTextSize (textFormat, Configuration.getHeight (26));
content.SetMaxWidth (Configuration.getWidth(583));
contenLayout.AddView (titleHeader);
contenLayout.AddView(content);
//contenLayout.SetX (Configuration.getHeight (45));
int padW = Configuration.getWidth(45);
int padH = Configuration.getHeight (15);
//contenLayout.SetPadding (padW,padH,padW,padH);
//contenLayout.SetY (Configuration.getWidth (12));
mainLayout.SetPadding (padW,padH,padW,padH);
mainLayout.AddView(contenLayout);
}
示例4: GetView
public override View GetView(int position, View convertView, ViewGroup parent)
{
if (nn_historycard [position].isdefaultcard) {
RelativeLayout layout = new RelativeLayout (nn_context);
AbsListView.LayoutParams param=new AbsListView.LayoutParams (AbsListView.LayoutParams.MatchParent,TapUtil.dptodx(45));
layout.LayoutParameters = param;
layout.SetPadding (TapUtil.dptodx(5),TapUtil.dptodx(5),TapUtil.dptodx(5),TapUtil.dptodx(5));
TextView defaultinfo = new TextView (nn_context);
defaultinfo.Gravity = GravityFlags.Center;
RelativeLayout.LayoutParams infoparam=new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.WrapContent);
infoparam.AddRule (LayoutRules.CenterInParent);
defaultinfo.LayoutParameters = infoparam;
defaultinfo.Text = nn_historycard [position].defaultinfo;
layout.AddView (defaultinfo);
return layout;
}
ViewHolder holder = null;
if (convertView == null) {
LayoutInflater inflator = LayoutInflater.From (nn_context);
convertView = inflator.Inflate (Resource.Layout.goals_eventhistory_item, null);
holder = new ViewHolder ();
holder.ContentView = convertView;
holder.eventnametextview = (TextView)convertView.FindViewById (Resource.Id.goals_eventhistory_eventnametextview);
holder.organizationtextview = (TextView)convertView.FindViewById (Resource.Id.goals_eventhistory_organizationnametextview);
holder.enddatetextview = (TextView)convertView.FindViewById (Resource.Id.goals_eventhistory_enddatetextview);
holder.sellresulttextview = (TextView)convertView.FindViewById (Resource.Id.goals_eventhistory_sellresulttextview);
holder.eventimageview=(ImageView)convertView.FindViewById (Resource.Id.goals_eventhistory_eventimage);
convertView.Tag=holder;
} else {
holder= (ViewHolder) convertView.Tag;
}
holder.eventnametextview.Text = nn_historycard [position].eventinfo.event_name;
holder.organizationtextview.Text = nn_historycard [position].eventinfo.organization;
string datetimestring="";
try{
DateTime eventEndTime=DateTime.ParseExact (nn_historycard [position].eventinfo.event_end_time.Substring (0, 19),
"yyyy-MM-ddTHH:mm:ss", null);
datetimestring=eventEndTime.ToShortDateString();
}
catch{
datetimestring = "";
}
holder.enddatetextview.Text = HistoryScreenData.RaisedLabelText+datetimestring;
int peronalrise = 0;
int goalamount = 0;
if (!string.IsNullOrEmpty(nn_historycard [position].eventinfo.gross_sales) ) {
peronalrise = Int32.Parse(nn_historycard [position].eventinfo.gross_sales);
}
if(!string.IsNullOrEmpty(nn_historycard [position].eventinfo.seller_goal)){
goalamount = Int32.Parse(nn_historycard [position].eventinfo.seller_goal);
}
decimal percent=(decimal)0;
if (!string.IsNullOrEmpty(nn_historycard [position].eventinfo.gross_sales) && !string.IsNullOrEmpty(nn_historycard [position].eventinfo.seller_goal)) {
if (peronalrise < 0 | goalamount < 0) {
percent = 0;
}else if(peronalrise>=goalamount){
percent = 1;
}else if(peronalrise<goalamount){
percent = (decimal)peronalrise / goalamount;
}
}
string sellresult_percentageformat = Math.Round(percent*100) +"%";
string raisedstring=String.Format(HistoryScreenData.RaisedLabelText+"{0}/"+HistoryScreenData.GoalLabelText+"{1}({2})",peronalrise,goalamount,sellresult_percentageformat);
holder.sellresulttextview.Text = raisedstring;
holder.eventimageview.SetImageBitmap (nn_historycard[position].bitmmapeventimage);
return convertView;
}
示例5: ini
public void ini(){
var textFormat = Android.Util.ComplexUnitType.Px;
var textFormatdip = Android.Util.ComplexUnitType.Dip;
mainLayout = new RelativeLayout (context);
mainLayout.LayoutParameters = new RelativeLayout.LayoutParams (-1,-1);
mainLinearLayout = new LinearLayout (context);
headerLinearLayout = new LinearLayout (context);
contentLinearLayout = new LinearLayout (context);
mainHeaderLinearLayout = new LinearLayout (context);
imHeader = new ImageView (context);
titleHeader = new TextView (context);
AutorHeader = new TextView (context);
content = new TextView (context);
titleHeader.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf");
AutorHeader.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf");
content.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf");
mainLinearLayout.LayoutParameters = new LinearLayout.LayoutParams (-1, -2);
mainHeaderLinearLayout.LayoutParameters = new LinearLayout.LayoutParams (-1, Configuration.getHeight(125));
contentLinearLayout.LayoutParameters = new LinearLayout.LayoutParams (-1, -2);
headerLinearLayout.LayoutParameters = new LinearLayout.LayoutParams (-1, -1);
mainLinearLayout.Orientation = Orientation.Vertical;
mainHeaderLinearLayout.Orientation = Orientation.Horizontal;
headerLinearLayout.Orientation = Orientation.Vertical;
contentLinearLayout.Orientation = Orientation.Vertical;
mainLinearLayout.AddView (mainHeaderLinearLayout);
mainLinearLayout.AddView (contentLinearLayout);
mainHeaderLinearLayout.AddView (imHeader);
mainHeaderLinearLayout.AddView (headerLinearLayout);
headerLinearLayout.AddView (titleHeader);
headerLinearLayout.AddView (AutorHeader);
headerLinearLayout.SetPadding (15, 0, 0, 10);
AutorHeader.SetPadding (0, 15, 0, 0);
contentLinearLayout.AddView (content);
contentLinearLayout.SetPadding (0, 15, 0, 0);
mainLinearLayout.SetBackgroundResource (Resource.Drawable.border);
// mainLinearLayout.SetX (Configuration.getHeight (45));
//mainLinearLayout.SetY (Configuration.getWidth (500));
//titleHeader.Text = "Diferentes tipos de aves en Perú";
titleHeader.SetTextColor (Color.ParseColor ("#FF0080"));
//titleHeader.SetTextSize (textFormat, Configuration.getHeight (38));
titleHeader.SetTextSize (textFormatdip, 16.0f);
titleHeader.SetMaxWidth (Configuration.getWidth (274));
titleHeader.SetMaxHeight (Configuration.getHeight (80));
//titleHeader.SetX (Configuration.getHeight (218));titleHeader.SetY (Configuration.getWidth (794-desviacion));
titleHeader.Ellipsize = TextUtils.TruncateAt.End;
titleHeader.SetMaxLines(2);
//AutorHeader.Text = "Autor del Articulo";
AutorHeader.SetTextColor(Color.ParseColor ("#424242"));
AutorHeader.SetTextSize (textFormat, Configuration.getHeight (23));
AutorHeader.SetMaxWidth (Configuration.getWidth (274));
//AutorHeader.SetMaxHeight (Configuration.getHeight (25));
//AutorHeader.SetX (Configuration.getHeight (218));AutorHeader.SetY (Configuration.getWidth (895-desviacion));
AutorHeader.Ellipsize = TextUtils.TruncateAt.End;
AutorHeader.SetMaxLines(1);
//content.Text = "Los factores geográficos, climáticos y evolutivos convierten al Perú en el mejor lugar para realizar la observacion de aves(birthwaching) Tiene 1830 especies de";
//content.SetTextSize (textFormat, Configuration.getHeight (24));
content.SetTextSize (textFormatdip, 12.0f);
content.SetMaxWidth (Configuration.getWidth(501));
//content.SetX (Configuration.getHeight (68));content.SetY (Configuration.getWidth (951-desviacion));
//content.Ellipsize = TextUtils.TruncateAt.End;
//content.SetMaxLines(4);
//imHeader.SetImageBitmap (Bitmap.CreateScaledBitmap (getBitmapFromAsset("icons/user.png"),Configuration.getWidth (124), Configuration.getHeight (124),true));
//imHeader.SetX (Configuration.getHeight (68));imHeader.SetY (Configuration.getWidth (792-desviacion));
imHeader.SetMaxWidth (Configuration.getWidth (124));
imHeader.SetMaxHeight (Configuration.getWidth (124));
int padW = Configuration.getWidth(45);
int padH = Configuration.getHeight (15);
mainLayout.SetPadding (padW,padH,padW,padH);
//.........这里部分代码省略.........
示例6: ini
public void ini(){
//var textFormat = Android.Util.ComplexUnitType.Px;
//var textFormatdip = Android.Util.ComplexUnitType.Dip;
mainLayout = new RelativeLayout (context);
mainLayout.LayoutParameters = new RelativeLayout.LayoutParams (-1,-1);
contenLayout = new LinearLayout (context);
contenLayout.LayoutParameters = new LinearLayout.LayoutParams (-2, -2);
contenLayout.Orientation = Orientation.Vertical;
imgMapa = new ImageView (context);
titleHeader = new TextView (context);
content = new TextView (context);
//titleHeader.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/ArcherMediumPro.otf");
//content.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/ArcherMediumPro.otf");
titleHeader.SetTextSize (ComplexUnitType.Fraction, Configuration.getHeight(38));
content.SetTextSize (ComplexUnitType.Fraction, Configuration.getHeight(32));
//textContent = new LinearLayout (context);
//textContent.LayoutParameters = new LinearLayout.LayoutParams (-2, -2);
imgMapa.SetX(Configuration.getWidth (350));
imgMapa.SetY (Configuration.getHeight (20));
mainLayout.AddView(imgMapa);
contenLayout.AddView (titleHeader);
contenLayout.AddView(content);
Console.WriteLine ("entro template2");
int padW = Configuration.getWidth(30);
int padH = Configuration.getHeight (5);
mainLayout.SetPadding (padW,padH,padW,padH);
mainLayout.AddView(contenLayout);
//mainLayout.SetBackgroundColor (Color.Cyan);
}
示例7: OnCreateView
//.........这里部分代码省略.........
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);
goalslinearlayout.LayoutParameters = goalslayoutparam;
goalslinearlayout.Orientation = Orientation.Horizontal;
goalslinearlayout.Id = TapUtil.generateViewId ();
int peronalrise = 0;
int goalamount = 0;
if (!string.IsNullOrEmpty(eventcard.eventinfo.gross_sales) ) {
peronalrise = Int32.Parse(eventcard.eventinfo.gross_sales);
}
if(!string.IsNullOrEmpty(eventcard.eventinfo.seller_goal)){
goalamount = Int32.Parse(eventcard.eventinfo.seller_goal);
}
LinearLayout raisedlinearlayout = new LinearLayout (nn_activity);
raisedlinearlayout.Orientation = Orientation.Vertical;
LinearLayout.LayoutParams raisedlayoutparam = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.MatchParent,TapUtil.dptodx(40));
raisedlayoutparam.Weight = 1;
raisedlinearlayout.LayoutParameters = raisedlayoutparam;
示例8: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate (bundle);
// Set our view from the "main" layout resource
SetContentView (Resource.Layout.Main);
using (var ignore = new TV.Ouya.Sdk.OuyaInputView(this))
{
// do nothing
}
FrameLayout content = (FrameLayout)FindViewById(Android.Resource.Id.Content);
if (null == content) {
Log.Info(TAG, "Failed to get content");
return;
}
RelativeLayout relativeLayout = new RelativeLayout (this);
content.AddView (relativeLayout);
FrameLayout.LayoutParams relativeLayoutParams = new FrameLayout.LayoutParams (FrameLayout.LayoutParams.MatchParent, FrameLayout.LayoutParams.MatchParent);
relativeLayout.LayoutParameters = relativeLayoutParams;
relativeLayout.SetPadding(0, 0, 0, 0);
LinearLayout verticalLayout = new LinearLayout (this);
relativeLayout.AddView (verticalLayout);
RelativeLayout.LayoutParams verticalLayoutParams = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.MatchParent);
verticalLayout.LayoutParameters = verticalLayoutParams;
verticalLayout.Orientation = Orientation.Vertical;
verticalLayout.SetGravity (GravityFlags.Center);
verticalLayout.SetPadding(0, 0, 0, 0);
for (int y = 0; y < 2; ++y) {
LinearLayout horizontalLayout = new LinearLayout (this);
verticalLayout.AddView (horizontalLayout);
LinearLayout.LayoutParams horizontalLayoutParams = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent);
horizontalLayout.LayoutParameters = horizontalLayoutParams;
horizontalLayout.Orientation = Orientation.Horizontal;
horizontalLayout.SetGravity (GravityFlags.Center);
horizontalLayout.SetPadding(0, 0, 0, 0);
int[] resources = {
Resource.Drawable.controller,
Resource.Drawable.a,
Resource.Drawable.dpad_down,
Resource.Drawable.dpad_left,
Resource.Drawable.dpad_right,
Resource.Drawable.dpad_up,
Resource.Drawable.lb,
Resource.Drawable.lt,
Resource.Drawable.l_stick,
Resource.Drawable.menu,
Resource.Drawable.o,
Resource.Drawable.rb,
Resource.Drawable.rt,
Resource.Drawable.r_stick,
Resource.Drawable.thumbl,
Resource.Drawable.thumbr,
Resource.Drawable.u,
Resource.Drawable.y,
};
for (int x = 0; x < 2; ++x) {
RelativeLayout controllerView = new RelativeLayout (this);
horizontalLayout.AddView (controllerView);
LinearLayout.LayoutParams controllerLayoutParams = new LinearLayout.LayoutParams (512, 512);
controllerView.LayoutParameters = controllerLayoutParams;
controllerView.SetGravity (GravityFlags.Center);
controllerView.SetPadding(100, 0, 0, 0);
Dictionary<int, ImageView> views = new Dictionary<int, ImageView> ();
foreach (int resourceId in resources) {
ImageView imageView = new ImageView (this);
controllerView.AddView (imageView);
imageView.SetImageResource (resourceId);
views [resourceId] = imageView;
}
VirtualControllerView controller = new VirtualControllerView (_controllers.Count,
views[Resource.Drawable.controller],
views[Resource.Drawable.a],
views[Resource.Drawable.dpad_down],
views[Resource.Drawable.dpad_left],
views[Resource.Drawable.dpad_right],
views[Resource.Drawable.dpad_up],
views[Resource.Drawable.lb],
views[Resource.Drawable.lt],
views[Resource.Drawable.l_stick],
views[Resource.Drawable.menu],
views[Resource.Drawable.o],
views[Resource.Drawable.rb],
views[Resource.Drawable.rt],
views[Resource.Drawable.r_stick],
views[Resource.Drawable.thumbl],
views[Resource.Drawable.thumbr],
views[Resource.Drawable.u],
views[Resource.Drawable.y]);
//.........这里部分代码省略.........
示例9: OnCreateView
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
RelativeLayout pagecontainder = new RelativeLayout (nn_activity);
pagecontainder.LayoutParameters = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.WrapContent);
ImageView leftarrowimg = new ImageView (nn_activity);
RelativeLayout.LayoutParams leftarrowimgparam = new RelativeLayout.LayoutParams (TapUtil.dptodx(32),TapUtil.dptodx(32));
leftarrowimgparam.AddRule (LayoutRules.AlignParentLeft);
leftarrowimgparam.AddRule (LayoutRules.CenterVertical);
leftarrowimg.SetImageResource (Resource.Drawable.ic_indicatorarrowleft);
leftarrowimg.Alpha = 0.5f;
leftarrowimg.Clickable = true;
leftarrowimg.LayoutParameters = leftarrowimgparam;
leftarrowimg.Click -= OnLeftArrowClick;
leftarrowimg.Click += OnLeftArrowClick;
ImageView rightarrowimg = new ImageView (nn_activity);
RelativeLayout.LayoutParams rightarrowimgparam = new RelativeLayout.LayoutParams (TapUtil.dptodx(32),TapUtil.dptodx(32));
rightarrowimgparam.AddRule (LayoutRules.AlignParentRight);
rightarrowimgparam.AddRule (LayoutRules.CenterVertical);
rightarrowimg.SetImageResource (Resource.Drawable.ic_indicatorarrowright);
rightarrowimg.Alpha = 0.5f;
rightarrowimg.Clickable = true;
rightarrowimg.LayoutParameters = rightarrowimgparam;
rightarrowimg.Click -= OnRightArrowClick;
rightarrowimg.Click += OnRightArrowClick;
RelativeLayout headercontainer = new RelativeLayout (nn_activity);
RelativeLayout.LayoutParams headercontainerlayout=new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.WrapContent);
headercontainer.LayoutParameters = headercontainerlayout;
headercontainer.Id = TapUtil.generateViewId ();
headercontainer.SetPadding (TapUtil.dptodx(30),TapUtil.dptodx(10),TapUtil.dptodx(30),TapUtil.dptodx(0));
eventimagview = new ImageView (nn_activity);
RelativeLayout.LayoutParams eventimagviewlayoutparam = new RelativeLayout.LayoutParams (TapUtil.dptodx(40),TapUtil.dptodx(40));
eventimagviewlayoutparam.AddRule (LayoutRules.CenterVertical);
eventimagview.LayoutParameters = eventimagviewlayoutparam;
eventimagview.SetImageResource (TapUtil.defaulticon);
eventimagview.Id = TapUtil.generateViewId ();
eventimagview.Background = new BitmapDrawable (Resources, nn_goalcard.ornanizationbitmap);
LinearLayout headerlinearlayout = new LinearLayout (nn_activity);
RelativeLayout.LayoutParams headerlayoutparam = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.WrapContent);
headerlayoutparam.AddRule (LayoutRules.RightOf, eventimagview.Id);
headerlayoutparam.LeftMargin = TapUtil.dptodx (5);
headerlinearlayout.LayoutParameters = headerlayoutparam;
headerlinearlayout.Orientation = Orientation.Vertical;
eventnametextview = new TextView (nn_activity);
LinearLayout.LayoutParams eventnametextviewparam = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.WrapContent,LinearLayout.LayoutParams.WrapContent);
eventnametextview.Text="eventname";
eventnametextview.Typeface = Typeface.DefaultBold;
eventnametextview.TextSize = TapUtil.dptodx(8);
eventnametextview.Gravity = GravityFlags.Center;
eventnametextviewparam.Gravity = GravityFlags.Center;
eventnametextview.Text = nn_goalcard.eventinfo.event_name;
eventnametextview.LayoutParameters = eventnametextviewparam;
organizationnametextview = new TextView (nn_activity);
LinearLayout.LayoutParams organizationnametextviewparam = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.WrapContent,LinearLayout.LayoutParams.WrapContent);
organizationnametextviewparam.Gravity = GravityFlags.Center;
organizationnametextview.Text="orgination";
organizationnametextview.Typeface = Typeface.DefaultBold;
organizationnametextview.TextSize = TapUtil.dptodx(6);
organizationnametextview.LayoutParameters = organizationnametextviewparam;
organizationnametextview.Text = nn_goalcard.eventinfo.organization;
organizationnametextview.InputType = global::Android.Text.InputTypes.TextFlagMultiLine;
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;
//.........这里部分代码省略.........
示例10: 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
//.........这里部分代码省略.........