width

Android set height and width of Custom view programmatically

人盡茶涼 提交于 2019-12-17 08:13:01
问题 I have created a custom view named Graphview . Here is the structure for the GraphView class. public class GraphView extends View { public GraphView(Context context, float[] values, String title, String[] horlabels, String[] verlabels, boolean type) { super(context); ........ } .................. ................. } I have added the view in a tablerow using addview() . It is working fine. Now I want to set height and width for the GraphView . How to do that? 回答1: The easy way is to set the

Android set height and width of Custom view programmatically

ぃ、小莉子 提交于 2019-12-17 08:11:28
问题 I have created a custom view named Graphview . Here is the structure for the GraphView class. public class GraphView extends View { public GraphView(Context context, float[] values, String title, String[] horlabels, String[] verlabels, boolean type) { super(context); ........ } .................. ................. } I have added the view in a tablerow using addview() . It is working fine. Now I want to set height and width for the GraphView . How to do that? 回答1: The easy way is to set the

Does setWidth(int pixels) use dip or px?

自闭症网瘾萝莉.ら 提交于 2019-12-17 06:22:16
问题 Does setWidth(int pixels) use device independent pixel or physical pixel as unit? For example, does setWidth(100) set the a view's width to 100 dips or 100 pxs? Thanks. 回答1: It uses pixels, but I'm sure you're wondering how to use dips instead. The answer is in TypedValue.applyDimension(). Here's an example of how to convert dips to px in code: // Converts 14 dip into its equivalent px Resources r = getResources(); int px = Math.round(TypedValue.applyDimension( TypedValue.COMPLEX_UNIT_DIP, 14

Div width 100% minus fixed amount of pixels

拈花ヽ惹草 提交于 2019-12-17 06:20:26
问题 How can I achieve the following structure without using tables or JavaScript? The white borders represent edges of divs and aren't relevant to the question. The size of the area in the middle is going to vary, but it will have exact pixel values and the whole structure should scale according to those values. To simplify it, I'd need a way to set "100% - n px" width to the top-middle and bottom-middle divs. I'd appreciate a clean cross-browser solution, but in case it's not possible, CSS hacks

How to set the width of a cell in a UITableView in grouped style

[亡魂溺海] 提交于 2019-12-17 02:33:22
问题 I have been working on this for about 2 days, so i thought i share my learnings with you. The question is: Is it possible to make the width of a cell in a grouped UITableView smaller? The answer is: No. But there are two ways you can get around this problem. Solution #1: A thinner table It is possible to change the frame of the tableView, so that the table will be smaller. This will result in UITableView rendering the cell inside with the reduced width. A solution for this can look like this:

How do I center my page while making my header take the full width of the browser window?

柔情痞子 提交于 2019-12-14 03:35:53
问题 I've seen tons of demos on the web about how "simple" it is to center the content on your page. I figured out how to make my header take up the entire width of the browser window however whenever I try to center my content all my browsers extend the width of the page, so I end up having a horizontal scrollbar. The other problem is my header is a different color than the rest of my browser so when I make changes to the body sometimes it changes the width of the header so that the color doesn't

Change the size of dragged clone when hovering droppable?

自闭症网瘾萝莉.ら 提交于 2019-12-14 02:41:18
问题 $(".drag").draggable({ helper: 'clone', appendTo: "body" }); $( ".drop" ).droppable({ over: function(event, ui) { $(ui.draggable).css({width:'30px',height:'30px'}); }, drop: function( event, ui ) { if($(ui.draggable).parent() !==$(this)){ $(ui.draggable).appendTo($( this )); $(ui.draggable).tooltip({ disabled: true }); $(ui.draggable).css({float:'left'}); } }}); I am trying to change the size of the dragged clone item when i hover over the droppable area but leave the original the same size

Image scale and animation improvement

时光总嘲笑我的痴心妄想 提交于 2019-12-14 02:33:22
问题 Can someone know how scale (width) to 100% of the screen a img element and keep big performances in animation ? In my first example, i set the width property to 100% . For testing purpose i made a animation loop in this fiddle to see performance chunk : http://jsfiddle.net/tXXmm/1/. I have 35fps when the image is hidden by the overflow of the parent element. When i remove the width property, i have 60fps to the same example : http://jsfiddle.net/tXXmm/2/ I need to know if there is some

Jquery and Jqueryui: set width not working after using resizable?

天涯浪子 提交于 2019-12-13 21:55:25
问题 I am writing a grid to show task durations. I have a set of divs in a display:block and when document is ready I use javascript and jqueryui to: 1) add child divs to the block divs 2) make the child divs draggable and resizable This works fine. I would also like to preset the divs width (the task duration), but there is a strange behavior: the divs do not resize after the document is loaded. However as soon as I click on the div border to resize it, the width "pops" to the value I used in the

How to calculate each element's height and use these values as a variable in function?

拥有回忆 提交于 2019-12-13 21:04:15
问题 I am trying to create a simple text accordion which calculates each panel's height and return this value as a variable. I can get values with if statements like if ( i === 0 ) { $(this).height(); } but can't get this variable to the outside.I can do this without using variable but it became useless in long term. Brıefly: I want to calculate each element's height and use this variable inside click function. Here is jsFiddle which includes the problem. var panel = $('.holder div'); var trigger