w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
UIScrollView auto layout - content size not set correctly
I took @robmayoff's suggestions and moved my button creation to code, and it miraculously worked. (I'm afraid Auto Layout is still Greek to me, but I somehow managed it.) In case anyone in the future needs to create a scrolling list of buttons, here's a way to do it that doesn't involve setting contentSize explicitly, if a little uglier than IB. self.toolbarScrollView.translatesAutoresizingMaskIntoConstraints = NO; NSMutableArray *toolbarItems = [NSMutableArray array]; //Unfortunately, you'll have to set the contentWidth manually - in viewDidLoad // the frames aren't set yet. 47.0 is the size (38) + margin (9) of one of my // buttons. CGFloat x = contentWidth - 47.0; //This code lets you page the scroll view with more spacing between items on //different pages. int itemCountPerPage =

Categories : Iphone

Content of scrollview changes size when scrolling
You have auto layout enabled in your storyboard. When you scroll the scroll view, auto layout runs and resets your subview frames based on the constraints in the storyboard. There are a few ways to fix this. One way is to turn off auto layout in your storyboard. Another way is to connect outlets to the constraints in your storyboard, and update the constraints (instead of setting the frames) to make auto layout put the views where you want them.

Categories : IOS

UIView with Auto layout, get his size
sizeToFit is the wrong API to use if you're using autolayout. The correct api to use for autolayout is UIView systemLayoutSizeFittingSize:, most likely passing UILayoutFittingCompressedSize. This will return a CGSize which is the minimum size that can bound the view with its specified constraints. Check this link EDIT: In response to the additional code that was posted... I've never used the Masonry library before but it's neat! UILabels provide an intrinsicContentSize that is large enough to display their text. In order to calculate this size for multi-line text the label needs to know a single dimension that will be fixed, and that is the desired-width dimension via the preferredMaxLayoutWidth property. If you don't provide a preferredMaxLayoutWidth value (defaults to 0), the

Categories : Iphone

layout_weight does not work when the layout inside a ScrollView is larger than the ScrollView
Try setting layout_height="0dp" on the elements that have layout_weight. The enclosing layout object will use any free space to grow them as much as it can. Also your use of weightSum is a bit questionable. Normally weightSum should be >= the total weights of the enclosed views. You have one weightSum where none of the directly enclosed views have weight and another where the total weight of the enclosed views exceeds weightSum. This second case will lead to strange behavior.

Categories : Android

Auto Layout: can't get the frame size of UICollectionViewCell subViews
In the end I added top, right, bottom and left spacing constraints on the imageview (to the superview), added IBOutlets to them and used something like this: CGFloat height = self.contentView.bounds.size.height - self.topConstraint.constant - self.bottomConstraint.constant; CGFloat width = self.contentView.bounds.size.width - self.leftConstraint.constant - self.rightConstraint.constant;

Categories : IOS

Update the preferredMaxLayoutWidth for a multiline UILabel with unknown size (Auto Layout)
Without seeing all the constrains you have setup for your custom view, and the superview that contains it, it's really hard to determine the problem, I suggest you to print out all the view frames of the entire view hierarchy starting from the view controller's view at viewDidLayoutSubviews and determine if the label and its superviews have correct frame set. I have an encountered similar issues with dynamic label size and scroll view so I created a prototype here, might be useful to you too: https://github.com/briandotnet/AutoLayoutScrollViewExperiment

Categories : IOS

How to make a view in a XIB/storyboard size to the phone dimensions without using auto layout
Yes, you can do it in the "Size Inspector", inside the Utilities menu. There you can set the autosizing and origin of any visible element. This works in iOS 5 and 6 and it's not required to use the Autolayout, which is only for iOS 6. Size inspector: Second screenshot:

Categories : IOS

How do I properly size in relative layout so my content isn't stretching on larger devices?
You should try nested Linear layout and thus using weights you may achieve a flexible user interface, try this <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/LinearLayout1" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#ffffff" android:orientation="vertical" tools:context=".MainActivity" > <TextView android:id="@+id/textView1" android:layout_width="match_parent" android:layout_height="60dip" /> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" > <TextView android:id="@+id/textView3" android:layout_width="0dp" android:la

Categories : Android

If I put scrollview then layout,layout doesn't show
You aren't setting any LayoutParams anywhere, so the layouts have no guidance on whether they should match their parent Views' height, wrap the content height, etc. I would suggest using a layout XML file instead, as it will make the process of defining, using, and adjusting your layout far easier. If you need to continue defining this in code for whatever reason, set LayoutParams for your Views. A View's LayoutParams come from the ViewGroup that contains them. For a View within a LinearLayout you should use LinearLayout.LayoutParams; Similarly a child View in a RelativeLayout uses RelativeLayout.LayoutParams. In this case, you would want to use LinearLayout.LayoutParams like so: LinearLayout ldialog = new LinearLayout(Gestionarez.this); ScrollView scroll = new ScrollView(Gestionarez

Categories : Java

How do I get auto layout to reposition a view when it's sibling view changes size?
There are a couple things that are causing problems. The first thing is that autolayout is supposed to ignore the object's frame. If you want to change the height of something, you change its height constraint, not the frame height. This is because constraints are applied after your layout and would override any frame changes. In addition, the red view looks like it is constrained to your superview "view" not "greenView". As far as editing the constraints, you can set up an IBOutlet and then modify the constant property of the UILayoutConstraint object.

Categories : IOS

Auto layout: auto update constraints when some view is empty
Does it need to change when content is visible? If not try this: you could do an update in the viewWillAppear method. For each label, call [firstLabel setNumberOfLines:0]; [firstLabel setText:newProductTitleText]; [firstLabel sizeToFit]; Setting number of lines to 0 lets the label dynamically use an many lines as it needs. If this is an empty label that should actually become 0 lines. This will update the frames and autolayout should take care of the rest.

Categories : IOS

ScrollView on this layout is not working as i want it
I managed to solve it b wrapping the container layout with a scrollView just by right click on the container select wrap container and choose Scrollview it will automatically wrap it with its specific attributes.

Categories : Android

Relative Layout in ScrollView
I experienced same problem with Relative Layout within Scroll View to overcome this i wrapped around my relative layout with a linear layout , try like this and also remove orientation from relative layout <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/ScrollView01" android:layout_width="match_parent" android:layout_height="match_parent" android:fillViewport="true" android:scrollbars="none" > <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent"> <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" > <Button android:id="@+id/continuePizza" android:layout_width="fill_parent" android:layout_height="

Categories : Android

how to prevent scrollview hiding other layout
try this <RelativeLayout android:id="@+id/RLayout_main" android:layout_width="Fill_parent" android:layout_height="Fill_parent" > <RelativeLayout android:id="@+id/RLayout1" android:layout_width="wrap_content" android:layout_height="wrap_content" > <Button android:id="@+id/homeButton" android:layout_width="40dip" android:layout_height="40dip" android:layout_marginLeft="10dip" android:layout_marginTop="10dip" android:background="@drawable/home_icon" /> <TextView android:id="@+id/textButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_marginTop="15dp" android:background="#0

Categories : Android

scrollview doesn't work in my layout
If you want to avoid buttons going up when the keyboard appears you could put android:windowSoftInputMode="adjustNothing" on the activity node of your Android Manifest. Then, they won't bother you when typing.

Categories : Android

ScrollView in nested layout in Android
Wrap the content inside a Contanier. One from FrameLayour, LinearLayout, RelativeLayout <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#E9E0DB" android:fillViewport="true" android:orientation="vertical" > <LinearLayout android:id="@+id/container" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical" > <!-- your components --> </LinearLayout> </ScrollView>

Categories : Android

elasticity - scrollView layout in android
http://www.javacodegeeks.com/2013/06/android-listview-pull-to-refresh.html You can try this , Maybe thats working for you .. :)

Categories : Android

Can we lock top and bottom view in a layout while we are using scrollview
It looks like android:layout_alignParentTop="true" is causing your scrollview to be placed on top of your header. Try this instead: android:layout_below="@id/textView1"

Categories : Android

Dynamically layout scrollview contentSize with AutoLayout
If you want the UILabel to stick at the bottom of its parent UIView using autolayout, then that view won't expand its height when the UILabel height increase, what really happens is that the UILabel will move up to occupy more area. I f you wish your UIView to expand, then don't use autolayout in that UIView, and position your UILabel at a constant origin, then change the view's height & the scrollview height as per the UILabel text. you can get the UILabel size using the below line of code: CGSize expectedLabelSize = [yourString sizeWithFont:yourLabel.font constrainedToSize:maximumLabelSize lineBreakMode:yourLabel.lineBreakMode];

Categories : IOS

Android setup scrollview with relative layout
Hopefully this example will get you started if I have understood you correctly. (Apologies if I have not.) <?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" android:background="#ff00ff00" > <ScrollView android:layout_width="match_parent" android:layout_height="match_parent" android:fillViewport="true" android:layout_above="@+id/footer" > <LinearLayout android:id="@+id/mainbody" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" > <TextView android:layout_widt

Categories : Android

Use scrollView between two Linear Layout inside a LinearLayout
i think I have understood your issue . you want to separate two views laying two side of Bar with two different scrollView. If it is so then below is solution <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/flightResultData" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginLeft="8dp" android:gravity="center_horizontal" android:orientation="horizontal" > <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" android:orientation="horizontal" > <ScrollView android:layout_width="wrap_content" android:layout_height="wrap_content"> <LinearLayout

Categories : Android

size of textview in scrollview
I had also faced the same issue before. After that I had removed the auto layout checkmark in xib.Its works for me now.Better to use like this.If you take those in xib. OR set the content size(value1,value2);

Categories : IOS

Multiple Views from Inflated Layout in horizontal ScrollView
I have add a layout file named scrollmain( only include a LinearLayout) ,and I test following code and it work well: //View view = inflater.inflate(R.layout.tab_fragment, container, false); LinearLayout layout = (LinearLayout) findViewById(R.id.scrollmain); LayoutInflater inflater = getLayoutInflater(); View view = inflater.inflate(R.layout.tab_fragment, null, false); layout.addView(view) LinearLayout pageLinearLayout = (LinearLayout)view.findViewById(R.id.pageLinearLayout); for(int i = 0; i < 3; i++){ View pageView = inflater.inflate(R.layout.article_layout, null); if(i % 2 != 0){ pageView.setBackgroundColor(Color.parseColor("#00ffff")); } pageLinearLayout.addView(pageView); } Good luck.

Categories : Android

How to align picture in center and assign its size mode to auto size at the same time?
You can try using this simple Panel control that will handle the two requirements for you: public class PanelImage : Panel { private Image image; public PanelImage() { this.DoubleBuffered = true; this.ResizeRedraw = true; } public Image Image { get { return image; } set { image = value; if (image != null) { this.AutoScrollMinSize = image.Size; } this.Invalidate(); } } protected override void OnPaint(PaintEventArgs e) { e.Graphics.Clear(Color.White); if (image != null) { Point p = this.AutoScrollPosition; if (image.Width < this.ClientSize.Width) { p.X = (this.ClientSize.Width / 2) - (image.Width / 2); } if (image.Height < this.ClientSize.Height) { p.Y = (this.ClientSize

Categories : C#

JQuery UI.Layout.ui-layout-west horizontal text size NOT with Scrollbar but resize panel
In layout-latest.js, there is one more west:{} section defined in $.layout = {} Inside this west section you need to write west: { side:left , cssReq:{ overflow:"auto" ,height:"auto" } }

Categories : Jquery

How to keep views in scrollview (that are inside a linear layout) that are not visible from being created?
You have a LinearLayout(vertical) with 30 children. If you scroll to the bottom, which views would then be "created"? If only the visible(or near visible) ones, then you can't measure how far down in the scroll they will be any more. If at that point you're just saying you should create them when they first appear, and stay around afterward, that could work. However, once you scroll around some, you'll still have a bunch of views, and the same problem you have now. Scrollviews exist and I happen to be using one. True, but that doesn't necessarily means it's the best tool for the job. I tried something similar with my first Android project. I didn't know much about ListViews, and ended up rolling my own adapter that sounds eerily similar to what you're doing. Long story short,

Categories : Android

How to change height of scrollview to not overlap linear layout in android?
in your linear layout (at the bottom) add it to be situated below the scrollview <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:orientation="horizontal" android:layout_below=""@+id/scrollView1" <-- this code > and also change the main base layout to linearlayout so it wont overlap <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizo

Categories : Android

Changing the size of ScrollView not working within the tableView
Also you need to adjust the height of cell in UITableView DataSource. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath; Because you reuse the cell inside tableview

Categories : Iphone

Subview of scrollview size zero even when text loaded not nil
That's probably because in viewWillAppear the subviews frames are not completly initialized yet. Instead, try to call your method in this method of your viewController: -(void)viewDidLayoutSubviews { [super viewDidLayoutSubviews]; [self setupView]; } See more information here: ScrollView created in storyboard initialized with frame 0,0,0,0

Categories : Iphone

Changing website layout based on screen size and browser window size in Rails
You need to use CSS to do this, it has nothing to do with Rails. See http://www.1stwebdesigner.com/css/responsive-website-tutorial/

Categories : CSS

How can I get a ScrollView with centered content and a footer?
I think the following gets close to what you want with the assumption that when you wrote 'The footer should just be centered horizontally and always stay at the bottom.' you meant the bottom of the screen. <?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" > <ScrollView android:layout_width="match_parent" android:layout_height="match_parent" android:fillViewport="true" android:layout_above="@+id/footer" > <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" > <LinearLayout android:layout_width="wrap_content"

Categories : Android

Scrollview content shows but not scrolling
For scroll view to scroll its Frame size must be smaller then its Content Size You have added the scrollView FROM code programatically but looks like you are talking about adding it through Xcode's Storyboard or in nib file IF you are adding it thought code you need to add following code [self.view addSubView:scrollView]; Here is one example @interface ImageScrollView () @property (nonatomic, strong) UIScrollView *scrollView; @property (nonatomic, strong) UIPageControl *pageControl; @end -(void) baseInit { // Scroll View - Full frame width _scrollView = [[UIScrollView alloc] init]; _scrollView.frame = self.frame; _scrollView.delegate = self; // ImageView - Full frame width CGFloat width = self.frame.size.width; CGFloat height = self.frame.size.h

Categories : IOS

UIWebView ScrollView Content Half-Drawn
You need 2 things: to have correct layout, (Autolayout since iOS 6.0) it's needed to put UIWebView on scrollview and than set scrollview size in webview delegate (after HTML rendering is finished)

Categories : IOS

how to overwrite ScrollView content in ios or change focus
The Better option is that when you clicked on UITextField at that time also hide your UITextField so your UITextField is not mixup with your UITableView and when You remove/hide your UITableView at that time your hidden UITextField again unHide( give hidden = NO). Other wise there are many ways for solve your problem, i like this option so i suggest you. Other Option is. Take your UITableView in UIView, i hope that you have already know that UITableView have its own ScrollView so you not need to put in/over any scrollView. And when you click on UITextFiled that are in UIScrollView at that time you also put restriction that user can not do with UIScrollView and UITextField also (give userInteraction = NO). so also give (give userInteraction = YES) when your UITableView is hide.

Categories : Iphone

Android ScrollView set height for displayed content
What you need is a maxHeight. But since views do not support it, you have to use a workaround. Check out this answer: http://stackoverflow.com/a/13811461/770467

Categories : Android

iOS Auto Layout: 3 column label layout, with middle column having variable width
Change gray box size programmatically ,on interface builder, set this properties for left text field https://dl.dropboxusercontent.com/u/1172778/left.png middle text field https://dl.dropboxusercontent.com/u/1172778/middle.png Texts will fill a container (gray box in your image). Sorry for my bad english.

Categories : IOS

scrollView does not display all the content top, and drawn too many of his bottom income
Do you need to set layout_weight in your ScrollView? If not remove this line or set it's value to 1. Also change the layout_width & layout_height to fill_parent in the child view.

Categories : Android

ScrollView not scrolling with LinearLayout that contains dynamic content in Android
The problem here is that you are adding ListView inside a ScrollView. Here is a quote from documentation You should never use a ScrollView with a ListView, because ListView takes care of its own vertical scrolling. Most importantly, doing this defeats all of the important optimizations in ListView for dealing with large lists, since it effectively forces the ListView to display its entire list of items to fill up the infinite container supplied by ScrollView. So you need to add only your items without ListView.

Categories : Android

scrollview content returns to original position when textfield resigns first responder
It depends on what you want to do when the user tries to touch outside the text field. One option would be to simply disable scrolling on the scroll view while the text field is editing, and then re-enabling it upon dismissal of the keyboard. A different option would be to implement the UIScrollViewDelegate method scrollViewWillBeginDragging: to detect the user is moving the scroll view, and then reseting the scrollview's offset, and resigning first responder from the text field from there. - (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView { if (myTextField.isFirstResponder) { [scrollView setContentOffset:originalOffset]; [myTextField resignFirstResponder]; } }

Categories : IOS

Text size vs other content size changing when zooming in on web page
It's an easy problem to get into, particularly for a beginner. Consider moving divs to percentage values etc. In terms of mobile viewing and standard desktop browsing, I would suggest you try using a grid system. One popular example which is very easy to use & I think is great for beginners is 960.gs I'm afraid without code snippets and your question being very generalised, its unlikely we can help. There are also ready to go grid systems that shift the page around depending on screen size but I wouldn't recommend them until you are comfortable using 960.gs

Categories : HTML



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.