layout

Layout - Relative to screensize

半腔热情 提交于 2021-01-29 04:41:19
问题 So I am a computer science student and I've finished my first year. I wanted to create a simple program and I realized that I am so tired of using no layout; this.setLayout(null); It is so tiresome to add bounds to every single component. Well, I have been using JPanel components and GridLayout a lot, which have made my work a bit easier. But I am tired of it. I care very much about the look of the GUI I make and use almost half the time programming to make the GUI look good before I start

“ArrayAdapter requires the resource ID to be a TextView” issue

拟墨画扇 提交于 2021-01-28 20:44:20
问题 I seem to have problems using custom styles for ListView. All online searches (stackOverflow and other sites) pty much say the same: - create an my_style.xml layout file. - use it in the adapter. But for some reason this doesn't seem to be working for me. MainAct.java: arrayAdapter = new ArrayAdapter<String>(this, android.R.layout.list_content, items); XML file: <?xml version="1.0" encoding="utf-8"?> <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id

MigLayout: how to resize the height proportionally to the width (keeping the aspect ratio)?

南笙酒味 提交于 2021-01-28 18:50:20
问题 I'm arranging images in a grid with MigLayout. I could get the width to take the whole space available in the column, but then I want the height to grow accordingly so the proportion of the image still fixed. What is the best approach for this? Could I do that with an expression in the constraint or I have to override the getPreferredSize()? Thanks! 回答1: After a lot of researching, I realize that there is no nice way of doing this with Swing. The problem is not only coming from MigLayout but

Text in 'stairs' layout by CSS or Javascript?

◇◆丶佛笑我妖孽 提交于 2021-01-28 18:20:48
问题 I'm trying to achieve with kind of layout inhtml/css/jquery (see attach file) Does anybody have any idea how this can be done ? I tried to put a css shape or svg for the line - which is fine, but how to make the text going this format ? Any highlight would be incredible, From my research I can't find any information like that ! thank you foe your time :) EDIT: what about this format ? 回答1: Here's one possibility in JS. It basically amounts to inserting floated divs of increasing widths, each

qgridlayout add and remove sub layouts

岁酱吖の 提交于 2021-01-28 09:13:08
问题 unfortunately, the answers to this question that I have found do not work for me. I think I make a mistake somewhere... I want to add content to a QGridLayout: int rows = 2; int columns = 2; for(int i=0; i<rows; ++i){ for(int j=0; j<columns; ++j){ QVBoxLayout *layout = new QVBoxLayout(); QComboBox *c1 = new QComboBox(); QComboBox *c2 = new QComboBox(); layout->addWidget(c1); layout->addWidget(c2); ui->gridLayout->addLayout(layout,i,j); } } I now want to change the content of this QGridLayout.

Is it possible to display a WPF Control in real-world, device-independent units? Milimeters, for example?

北慕城南 提交于 2021-01-28 06:34:29
问题 I am designing a product emulator in WPF. Our company sells a handheld electronic medical device, and we'd like to experiment with user interaction with a "virtual", skinned (sort of) GUI to represent buttons and leds. Is there a way to "force" WPF to display stuff with its real-world dimension on the screen (by getting monitor dpi information, or something like this)? As another example, suppose I can layout a plastic, standard-sized Credit Card using WPF controls (DockPanels, Labels,

How to scale Label within a ListView in JavaFX

主宰稳场 提交于 2021-01-28 05:08:23
问题 I have a ListView with some Labels in it. The labels' width property is bound to the width property of the ListView but they seem to be slightly larger meaning that a horizontal scrollbar is shown on the list view. What I want is to fit the labels in the list view without the scrollbar on the bottom. I have looked at various padding and insets values on both the label and the list view but none I have found are the culprit (most are zero). Here is an example which demonstrates the problem.

matplotlib: get the subplot layout?

天涯浪子 提交于 2021-01-28 02:58:15
问题 I have a function that creates a grid of similar 2D histograms. So that I can select whether to put this new plot on a pre-existing figure, I do the following: def make_hist2d(x, y, current_fig=False, layout=(1,1,1),*args): if current_fig: fig = _plt.gcf() ax = fig.add_subplot(*layout) # layout=(nrows, ncols, nplot) else: fig, ax = _plt.subplots() H, x, y = np.histogram2d(...) # manipulate the histogram, e.g. column normalize. XX, YY = _np.meshgrid(xedges, yedges) Image = ax.pcolormesh(XX, YY

Soft keyboard pushing layout

南笙酒味 提交于 2021-01-28 02:29:27
问题 I have been trying many solutions out there for preventing the soft keyboard from pushing my layout when it appears. However, all solutions did not work. Simply, I want everything in my layout (buttons, imageViews, Background, textViews, textEdits) to stay in place when soft keyboard is shown. I do not care about what it will cover. I tried all of the following and all produced the same output and do not work: (did not work) I tried writing android:windowSoftInputMode="adjustNothing" in my

How to get constraint “bottomSpace” from UIView Programmatically?

只愿长相守 提交于 2021-01-27 21:17:42
问题 I need change center of some views programmatically. 10 or more. I don't want to adding each bottom constraint as outlet, so could I search them from code like as: for(NSLayoutConstraint *constraint in view.constraints) Which attributes should I check? I need constraint for bottom space of superview. 回答1: Have you heard about IBOutletCollection ? When you link any object from IB to VC code, in popup window you can select IBOutletCollection Option. After link all constraints you want, only