layout

How to get exactly the same point on different screen sizes?

五迷三道 提交于 2021-02-05 07:48:58
问题 I want to call the action (go to another view) when user tap specific area of image (black dots): . Image fills whole view, content mode is 'Aspect Fit'. The problem is that when I setup it on one screen size (e.g. iPhone 8) on another the 'tap area' is shifted. I've tried to solve this with button and constraints or UITapGestureRecognizer with point conversion using screen resolution (nativeBounds), but nothing helps. 回答1: It is possible to use constraints to match the positions of the

How to align multiple elements below each other?

本小妞迷上赌 提交于 2021-02-05 07:36:38
问题 I am having difficulty in aligning Swing elements flow below each other. Using GridLayout does not help me because it divides screen to rows which have equal sizes. I need to put one component to each row and the next component should be in very bottom of the last component. Mi problem is that if the choices of the question are more than one line, this layout squeeze them to the rows and there is a huge gap between picture and question "3+3?" 回答1: You can use GridBagLayout for this. It is

CSS to align label and inputs on form

白昼怎懂夜的黑 提交于 2021-02-05 05:25:07
问题 I have a problem with aligning my labels and input fields in a form. Time and again I end up with something like this: Which is produced with HTML like so: ... <ul> <li> <label for="STREET">Street</label> <input data-val="true" data-val-required="The Street field is required." id="STREET" name="STREET" type="text" value="P.O. Box 1053" /> </li> <li> <label for="SUITE">Suite</label> <input id="SUITE" name="SUITE" type="text" value="" /> </li> <li> <label for="city">City</label> <input data-val

ListView only one element shown with height = “wrap_content”

烈酒焚心 提交于 2021-01-29 12:43:38
问题 On my fragment layout I have a Nested Scroll view with two relative layout inside, top and bottom, on the bottom I have a listview with about twenty elements, but if I set the height of the listview with wrap_content, only one line is shown, whereas if I set the height to 1000dp, for example, all the lines are shown, I wouldn't want to fix the height in a static way but I'd rather use wrap_content, what can I do? <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"

SwiftUI horizontal alignment from center to the right

谁都会走 提交于 2021-01-29 11:42:50
问题 I am trying to align a dynamic collection (ie of varying count) of views to the right of a centered view, without moving the center view from its original, center position. For example, the center view is Text("12") and the views to the right are [Text("+3"), Text("+10"), Text("-1")] so I want the views to the right of 12 be displayed to its right, while 12 is centered horizontally on the screen: | 12 +3 +10 -1 | If I try using an HStack the 12 will move away from center. Is there a view

Nativescript Add ScrollView through Code (Javascript)

若如初见. 提交于 2021-01-29 08:50:36
问题 Using Javascript with Nativescript and I am loading a page through code rather than XML. I have it all working, however I want to add a ScrollView and then place a layout with in that. How would I go about this? I have tried: var scroll = new ScrollView(); var stackLay = new StackLayout(); stackLay.addChild(stuff); .... scroll.addChild(stackLay); However, I get error "scroll.addChild is not a function" Thanks. 回答1: ScrollView is not a layout but inherited from ContentView , therefore you can

Making python's matplotlib graphics look like graphics created using OriginPro

China☆狼群 提交于 2021-01-29 08:45:33
问题 I may have created a duplicate, but could not find exactly what I was looking for in any thread. I created graphics using OriginPro 8.5G and can not quite re-create them using matplotlib. I am quite new to styling graphics using mpl, but I will attach, what I have already tried and show some pictures. Plot created using OriginPro 8.5G Plot created using matplotlib.pyplot The code used is as follows: import matplotlib as mpl from matplotlib import rcParams, cycler import matplotlib.pyplot as

How to make a widget's size same as another widget in Flutter

白昼怎懂夜的黑 提交于 2021-01-29 08:43:35
问题 The length of the texts on right is not fixed. I want to make the height of the line on left same as the texts area height. Is there a way to align a widget to another widget like Android's RelativeLayout or ConstraintLayout in Flutter? my code: Container( padding: EdgeInsets.fromLTRB(100, 0, 100, 0), child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Container( color: Color(0xFFEEEEEE), width: 4, height: 80, margin: EdgeInsets.only(right: 10), ), Expanded( child:

RecyclerView doesn't show up in Android Studio Preview

允我心安 提交于 2021-01-29 06:08:33
问题 This is what I am getting when I add a recyclerView in my layout.(I already imported the dependency) My Layout: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <androidx.recyclerview.widget.RecyclerView android:layout_width="match_parent" android:layout_height="match_parent" /> </RelativeLayout> This is when I set height and width to wrap content: Here I

Android: can't change NavigationIcon of v7 Support Toolbar

早过忘川 提交于 2021-01-29 05:07:47
问题 I'm developing an Activity using SDK v22 (I use targetSDKVersion 22 e minSdkVersion 18 for backward compatibility). My activity uses a navigationbar called by the AppBar. I would like change the NavigationIcon over the app bar but I couldn't. I tried with "app:navigationIcon" setting in XML layout and with setNavigationIcon method. Any idea? Here my Activity Class code: public class MyActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener { @Override