private void Initialize() { ImageView logo = new ImageView(Context) { Id = 0x0fffff2a }; logo.SetImageResource(Resource.Drawable.logo); logo.SetAdjustViewBounds(true); logo.SetMinimumHeight(60); logo.SetMaxHeight(60); _imageCategoryView = new ImageView(Context); _imageCategoryView.SetAdjustViewBounds(true); _imageCategoryView.SetMinimumHeight(60); _imageCategoryView.SetMaxHeight(60); _imageCategoryView.Id = 0x0fffff2b; _imageCategoryView.SetMinimumWidth(60); _imageCategoryView.SetMaxWidth(60); _imageCategoryView.Measure(60, 60); _textCategoryView = new TextView(Context); _textCategoryView.SetMaxHeight(60); _textCategoryView.SetTextColor(Color.Black); _textCategoryView.Id = 0x0fffff2c; _textCategoryView.SetTextSize(ComplexUnitType.Sp, 15); _textCategoryView.Gravity = GravityFlags.CenterVertical; LayoutParams lp = new LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent); lp.AddRule(LayoutRules.AlignParentRight); lp.AddRule(LayoutRules.CenterVertical); AddView(logo, lp); lp = new LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent); lp.AddRule(LayoutRules.AlignParentLeft); lp.AddRule(LayoutRules.CenterVertical); AddView(_imageCategoryView, lp); lp = new LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent); lp.AddRule(LayoutRules.RightOf, _imageCategoryView.Id); lp.AddRule(LayoutRules.CenterVertical); lp.SetMargins(60, 0, 60, 0); AddView(_textCategoryView, lp); }
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); mainLayout.AddView (mainLinearLayout); /* mainLayout.AddView (titleHeader); mainLayout.AddView (AutorHeader); mainLayout.AddView (content); mainLayout.AddView (imHeader); */ }