Questions tagged [view]
This tag is for questions about database view or UI / architectural view. See also the following tags: sql-view, android-view, uiview.
26,078
questions
729
votes
12
answers
666k
views
Get root view from current activity
I know how to get the root view with View.getRootView(). I am also able to get the view from a button's onClick event where the argument is a View. But how can I get the view in an activity?
671
votes
38
answers
439k
views
Attempt to present UIViewController on UIViewController whose view is not in the window hierarchy
Just started using Xcode 4.5 and I got this error in the console:
Warning: Attempt to present < finishViewController: 0x1e56e0a0 > on < ViewController: 0x1ec3e000> whose view is not in the ...
587
votes
15
answers
268k
views
Difference between a View's Padding and Margin
What is the difference between a View's Margin and Padding?
487
votes
30
answers
402k
views
Android: How do I prevent the soft keyboard from pushing my view up?
I have a vertical sliding drawer at the bottom of my app. When the soft keyboard opens, it pushes the tab for the drawer up, so it sits atop the keyboard. I actually want it to remain at the bottom of ...
460
votes
7
answers
286k
views
What is the main purpose of setTag() getTag() methods of View?
What is the main purpose of such methods as setTag() and getTag() of View type objects?
Am I right in thinking that I can associate any number of objects with a single View?
433
votes
8
answers
778k
views
What is the difference between Views and Materialized Views in Oracle?
What is the difference between Views and Materialized Views in Oracle?
392
votes
18
answers
289k
views
Animate change of view background color on Android
How do you animate the change of background color of a view on Android?
For example:
I have a view with a red background color. The background color of the view changes to blue. How can I do a ...
344
votes
3
answers
154k
views
onMeasure custom view explanation
I tried to do custom component. I extended View class and do some drawing in onDraw overrided method. Why I need to override onMeasure? If I didn't, everything seen to be right. May someone explain it?...
323
votes
8
answers
369k
views
How to create EditText with rounded corners?
How to create an EditText that has rounded corners instead of the default rectangular-shaped corners?
311
votes
22
answers
398k
views
SwiftUI - How do I change the background color of a View?
Is there a straightforward way to change the background of a View using SwiftUI?
286
votes
5
answers
224k
views
View array in Visual Studio debugger? [duplicate]
Is it possible to view an array in the Visual Studio debugger? QuickWatch only shows the first element of the array.
286
votes
11
answers
377k
views
Set margins in a LinearLayout programmatically
I'm trying to use Java (not XML) to create a LinearLayout with buttons that fill the screen, and have margins. Here is code that works without margins:
LinearLayout buttonsView = new LinearLayout(...
279
votes
7
answers
320k
views
Display a view from another controller in ASP.NET MVC
Is it possible to display a view from another controller?
Say for example I have a CategoriesController and a Category/NotFound.aspx view. While in the CategoriesController, I can easly return View("...
278
votes
18
answers
212k
views
Replace Fragment inside a ViewPager
I'm trying to use Fragment with a ViewPager using the FragmentPagerAdapter.
What I'm looking for to achieve is to replace a fragment, positioned on the first page of the ViewPager, with another one.
...
268
votes
11
answers
210k
views
Google Chrome display JSON AJAX response as tree and not as a plain text
I cannot find an answer to this one:
My AJAX calls return JSON data. In Google Chrome Developer Tools > Resources > XHR when I click on the resource on the left and then on the Content tab I see ...
266
votes
9
answers
210k
views
Show the CREATE VIEW code for a view in PostgreSQL?
Is there an easy way to see the code used to create a view using the PostgreSQL command-line client?
Something like the SHOW CREATE VIEW from MySQL.
259
votes
12
answers
215k
views
setBackground vs setBackgroundDrawable (Android)
I want to set background drawable of a view. There are two methods for this (as far as I see): setBackground and setBackgroundDrawable.
When I use setBackground, it says it has been added in API ...
254
votes
19
answers
289k
views
How to make a smooth image rotation in Android?
I'm using a RotateAnimation to rotate an image that I'm using as a custom cyclical spinner in Android. Here's my rotate_indefinitely.xml file, which I placed in res/anim/:
<?xml version="1.0" ...
251
votes
27
answers
190k
views
Is there a way to programmatically scroll a scroll view to a specific edit text?
I have a very long activity with a scrollview. It is a form with various fields that the user must fill in. I have a checkbox half way down my form, and when the user checks it I want to scroll to a ...
245
votes
13
answers
498k
views
How to Set Opacity (Alpha) for View in Android
I have a button as in the following:
<Button
android:text="Submit"
android:id="@+id/Button01"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
&...
234
votes
5
answers
145k
views
Can I get the name of the current controller in the view?
Is there a way to figure out what the current controller is from within the view?
For an example of why I would want to know this: if several controllers share the same layout, I may have a part in ...
224
votes
22
answers
203k
views
How to remove all subviews of a view in Swift?
I'm looking for a simple method to remove at once all subviews from a superview instead of removing them one by one.
//I'm trying something like this, but is not working
let theSubviews : Array = ...
221
votes
15
answers
436k
views
Getting activity from context in android
This one has me stumped.
I need to call an activity method from within a custom layout class. The problem with this is that I don't know how to access the activity from within the layout.
...
213
votes
10
answers
296k
views
What is the difference between a stored procedure and a view?
I am confused about a few points:
What is the difference between a stored procedure and a view?
When should I use stored procedures, and when should I use views, in SQL Server?
Do views allow the ...
212
votes
7
answers
457k
views
Difference between View and table in sql
Possible Duplicate:
Difference Between Views and Tables in Performance
What is the main difference between view and table in SQL. Is there any advantage of using views instead of tables.
208
votes
18
answers
158k
views
Android: why is there no maxHeight for a View?
View's have a minHeight but somehow are lacking a maxHeight:
What I'm trying to achieve is having some items (views) filling up a ScrollView. When there are 1..3 items I want to display them directly....
200
votes
22
answers
520k
views
How to set background color of a View
I'm trying to set the background color of a View (in this case a Button).
I use this code:
// set the background to green
v.setBackgroundColor(0x0000FF00 );
v.invalidate();
It causes the Button to ...
196
votes
8
answers
293k
views
Set the absolute position of a view
Is it possible to set the absolute position of a view in Android? (I know that there is an AbsoluteLayout, but it's deprecated...)
For example, if I have a 240x320px screen, how could I add an ...
192
votes
8
answers
211k
views
Android - get children inside a View?
Given a View how can I get the child views inside it?
So I have a custom View and debugger shows that under mChildren there are 7 other views.
I need a way to access these views but it doesn't seem ...
190
votes
5
answers
104k
views
What are dictionary view objects?
In python 2.7, we got the dictionary view methods available.
Now, I know the pro and cons of the following:
dict.items() (and values, keys): returns a list, so you can actually store the result, and
...
188
votes
4
answers
132k
views
Android layout replacing a view with another view on run time
I have a xml-layout file main with two textviews A/B and a view C.
I have two other xml-layout files option1 and option2.
Is it possible to load either option1 or option2 in run time via Java into C? ...
182
votes
3
answers
59k
views
What is the difference between Xamarin.Form's LayoutOptions, especially Fill and Expand?
In Xamarin.Forms every View has the two properties HorizontalOptions and VerticalOptions. Both are of type LayoutOptions and can have one of the following values:
LayoutOptions.Start
LayoutOptions....
179
votes
10
answers
331k
views
Android set height and width of Custom view programmatically
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,...
178
votes
5
answers
173k
views
Perform Segue programmatically and pass parameters to the destination view
in my app I've a button that performs a segue programmatically:
- (void)myButtonMethod
{
//execute segue programmatically
[self performSegueWithIdentifier: @"MySegue" sender: self];
}
I ...
175
votes
22
answers
481k
views
Can we pass parameters to a view in SQL?
Can we pass a parameter to a view in Microsoft SQL Server?
I tried to create view in the following way, but it doesn't work:
create or replace view v_emp(eno number) as select * from emp where ...
162
votes
5
answers
298k
views
Android - Dynamically Add Views into View
I have a layout for a view -
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
...
161
votes
8
answers
123k
views
Measuring text height to be drawn on Canvas ( Android )
Any straight forward way to measure the height of text?
The way I am doing it now is by using Paint's measureText() to get the width, then by trial and error finding a value to get an approximate ...
155
votes
10
answers
226k
views
How can I check if a View exists in a Database?
I have some SQL code that needs to be executed if a certain View exists in a database. How would I go about checking if the View exists?
EDIT: The DBMS being used is Microsoft SQL Server
144
votes
7
answers
169k
views
Create a custom View by inflating a layout?
I am trying to create a custom View that would replace a certain layout that I use at multiple places, but I am struggling to do so.
Basically, I want to replace this:
<RelativeLayout
android:id=...
141
votes
16
answers
72k
views
Software keyboard resizes background image on Android
Whenever the software keyboard appears, it resizes the background image. Refer to the screenshot below:
As you can see, the background is sort of squeezed. Anyone can shed a light on why the ...
129
votes
20
answers
182k
views
How to make a view with rounded corners?
I am trying to make a view in android with rounded edges. The solution I found so far is to define a shape with rounded corners and use it as the background of that view.
Here is what I did, define a ...
128
votes
5
answers
109k
views
What's an elegant way to conditionally add a class to an HTML element in a view?
I occasionally have to add a class to an html element based on a condition. The problem is I can't figure out a clean way of doing it. Here's an example of the stuff I've tried:
<div <%= if @...
128
votes
8
answers
141k
views
When to use a View instead of a Table?
When should a View actually be used over an actual Table? What gains should I expect this to produce?
Overall, what are the advantages of using a view over a table? Shouldn't I design the table in ...
127
votes
1
answer
34k
views
How do I access the ModelState from within my View (aspx page)?
How do I access the ModelState from within my View (aspx page)?
123
votes
4
answers
137k
views
View's SELECT contains a subquery in the FROM clause
I have two tables and I need to create a view. The tables are:
credit_orders(id, client_id, number_of_credits, payment_status)
credit_usage(id, client_id, credits_used, date)
I use the following ...
119
votes
13
answers
277k
views
How can I dynamically set the position of view in Android?
How can I change the position of view through code? Like changing its X, Y position. Is it possible?
119
votes
14
answers
63k
views
Is it possible to determine whether ViewController is presented as Modal?
Is it possible to check inside ViewController class that it is presented as modal view controller?
117
votes
4
answers
31k
views
How to efficiently get a `string_view` for a substring of `std::string`
Using http://en.cppreference.com/w/cpp/string/basic_string_view as a reference, I see no way to do this more elegantly:
std::string s = "hello world!";
std::string_view v = s;
v = v.substr(6, 5); // "...
115
votes
10
answers
80k
views
How to pass one SwiftUI View as a variable to another View struct
I'm implementing a very custom NavigationLink called MenuItem and would like to reuse it across the project. It's a struct that conforms to View and implements var body : some View which contains a ...
111
votes
3
answers
158k
views
Can I create view with parameter in MySQL?
I have a view like this:
CREATE VIEW MyView AS
SELECT Column FROM Table WHERE Value = 2;
I'd like to make it more generic, it means to change 2 into a variable. I tried this:
CREATE VIEW MyView ...