We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Position Center

Thread ID:





119205 May 21,2015 08:10 PM UTC May 22,2015 11:59 AM UTC Android 1
Tags: SfDigitalGauge
Asked On May 21, 2015 08:10 PM UTC

Wanted to know how centralize digital gauge , because when as wrap_content (required space) it takes up space and all the gauge is in the upper left corner , how can I fix it without the need for various calculations to center ?

Attachment: quest.jpg_be09b1a8.zip

Paul Anderson S [Syncfusion]
Replied On May 22, 2015 11:59 AM UTC


Thank you for using Syncfusion products.

We would like to inform that the gauge can be added in any layout and it can be positioned using ‘setGravity’ method available in layouts.By default the gauge will have the size of the available space. So it is needed to set the control size based on the CharacterHeight of the control. For further customizing the positions setX and setY methods can be used for modifying its X and Y positions. Please refer the below code snippet for positioning through layout.

[Code Snippet]
SfDigitalGauge digitalGauge1 = new SfDigitalGauge(context);

float cheight = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_PT,(float) digitalGauge1.getCharacterHeight() , context.getResources().getDisplayMetrics());

float cwidth = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_PT,(float)( 8*digitalGauge1.getCharacterWidth()+8*digitalGauge1.getCharactersSpacing()) , context.getResources().getDisplayMetrics());

digitalGauge1.setLayoutParams(new LinearLayout.LayoutParams((int)cwidth, (int) cheight));
LinearLayout gaugeLayout = new LinearLayout(context);

Please let us know if you need any further assistance on this.

Paul Anderson S


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon