layout

Android - How to place a button on a specific position on different screen densities with XML

浪子不回头ぞ 提交于 2020-02-03 08:48:07
问题 I am looking for a way to place a button on a specific spot with the help of XML. I want the button in question to be placed in the middle of the screen, only abit down. This I would like to be working even when changing screen densities. I have tried using android:layout_marginLeft="10dp", but it doesnt show up at the same position when i lower the densities from 240 till 120. It says on androids dev page that dp should be used and will scale with the screen, which in this case doesnt seem

Is there any difference between “center_horizontal|center_vertical” and “center”

霸气de小男生 提交于 2020-02-03 05:31:05
问题 I want to center an image in a linearLayout. Is there any difference between android:gravity="center_horizontal|center_vertical" and android:gravity="center" ? 回答1: No, there is no difference. According to source code public static final int CENTER = CENTER_VERTICAL|CENTER_HORIZONTAL; 回答2: There really is not difference between the two except that it's less code using center . combining center_horizontal and center_veritcal is the equivalent of center 回答3: I know this is old question but i

Distorted spacing between div elements after sorting with jqui_sortable

孤街浪徒 提交于 2020-02-01 05:40:29
问题 While building a very nice additional functionality into my shiny app where the user can reorganize the plots inside the page, I ran into 1 problem. I noticed that the spacing between the div elements that are being relocated (sorted), changes while doing so, resulting in a misalignment of the plots afterwards. I have tried to adjust margin values to nothing, 0 or a certain amount of pixels, but that doesn't seem to solve this. The app that I made to test / illustrate the issue is posted

Graph Hierarchical Layout Algorithm

大憨熊 提交于 2020-02-01 04:44:47
问题 There are many tools and SDKs which layout a graph. ogdf, GraphViz, mxGraph, yEd... One of useful layouts is "Hierarchical Layout". But there is no pure algorithm or pseudo code to describe it. Even, There is not a clear definition of this type of layout. Is anyone know about the algorithm? 回答1: (source: yworks.com) Simple hierarchical layout algorithm is visualisation of the ASAP sheduling algorithm (check this lecture [link]), so it'd be better to read it, on my view. BTW your picture is

Even Flexbox product grid with left alignment

折月煮酒 提交于 2020-01-31 19:33:10
问题 I'm trying to get a nice Flexbox grid to use with ecommerce products, but can't quite get it to do what I want. Here is a demo http://jsbin.com/acejes/9/edit It may not be possible, I just wanted to check if there's anything else I can do. Here is my aim… Must be a percentage based grid The first and last column flush against the sides of the container The last row "floats" left My question is kind of similar to How to align left last row/line in multiple line flexbox, but I specifically want

Android: How to avoid layout being pushed when keyboard invoked

蓝咒 提交于 2020-01-31 05:55:27
问题 I have a layout as below <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:weightSum="1"> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello" /> <LinearLayout android:id="@+id/linearLayout1" android:layout_width="match_parent" android:layout_height="wrap_content">

Android: How to avoid layout being pushed when keyboard invoked

☆樱花仙子☆ 提交于 2020-01-31 05:54:08
问题 I have a layout as below <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:weightSum="1"> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello" /> <LinearLayout android:id="@+id/linearLayout1" android:layout_width="match_parent" android:layout_height="wrap_content">

JavaFx elements, change the size dynamically in relationship to the size of the window

夙愿已清 提交于 2020-01-30 08:38:27
问题 I have this: A borderPane with left node a Vbox (green arrow) with button inside(orange arrow). What I can not do is find a way to change the dimensions of Vbox(green segment) and then for the button (orange segment) in accordance with the size of the window. (when the user plays with the window size) I prefer to find a way to set the parameters into my css files, or as a last resort inside my fxml. .css file: .left-borderPane{ /*this is style class for Vbox */ /*something so similar: */ -fx

Rails Layout name inside view

对着背影说爱祢 提交于 2020-01-30 05:16:11
问题 How can I print out the name of current layout in a view? Example puts controller.current_layout Thx 回答1: This works with Rails 3.0.7: controller.send :_layout Obviously, it's a private method, so use at your own risk. 回答2: This works for me: response.layout UPDATE: True, response.layout does not work in rails3+ thus I usually define a @layout_name variable inside each layout. Example of application.html.haml - @layout_name = 'application' !!! Strict %html ... 回答3: <%= controller.active

Rails Layout name inside view

独自空忆成欢 提交于 2020-01-30 05:15:17
问题 How can I print out the name of current layout in a view? Example puts controller.current_layout Thx 回答1: This works with Rails 3.0.7: controller.send :_layout Obviously, it's a private method, so use at your own risk. 回答2: This works for me: response.layout UPDATE: True, response.layout does not work in rails3+ thus I usually define a @layout_name variable inside each layout. Example of application.html.haml - @layout_name = 'application' !!! Strict %html ... 回答3: <%= controller.active