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.

The purpose of almost any computer program is to process data in one form or another. When the program requires user interaction it is often necessary to provide the user with a view of that data to represent it in a useful and comprehensible manner.

View also refers to:

  • A stored query in a relational database that can be accessed as if it were a table.
  • The display or presentation layer of a MVC architecture.

Questions tagged should also be tagged with the relevant language.

25981 questions
260
votes
12 answers

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 level 16 but my project's min SDK version is 7. I…
Pijusn
  • 11,025
  • 7
  • 57
  • 76
255
votes
9 answers

How to see 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.
Elias Dorneles
  • 22,556
  • 11
  • 85
  • 107
252
votes
19 answers

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/:
emmby
  • 99,783
  • 65
  • 191
  • 249
248
votes
27 answers

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 specific part of the view. Is there any way to…
244
votes
13 answers

How to Set Opacity (Alpha) for View in Android

I have a button as in the following: In my onCreate() event, I am calling Button01…
ncakmak
  • 4,014
  • 5
  • 20
  • 17
231
votes
5 answers

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 the layout ERB file where I want to highlight the…
Dan Tao
  • 125,917
  • 54
  • 300
  • 447
221
votes
22 answers

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 = container_view.subviews for (view : NSView) in…
Alberto
  • 4,212
  • 5
  • 22
  • 36
213
votes
15 answers

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. ProfileView public class ProfileView extends LinearLayout { …
OVERTONE
  • 11,797
  • 20
  • 71
  • 87
209
votes
7 answers

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.
Mahesh KP
  • 6,248
  • 13
  • 50
  • 71
205
votes
18 answers

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. Meaning the ScrollView has the height of either…
znq
  • 44,613
  • 41
  • 116
  • 144
203
votes
10 answers

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 creation of dynamic queries where we can pass…
NoviceToDotNet
  • 10,387
  • 36
  • 112
  • 166
198
votes
22 answers

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 disappear from the screen. What am I doing wrong,…
Peter vdL
  • 4,953
  • 10
  • 40
  • 60
195
votes
8 answers

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 ImageView which is 20x20px such that its center is at…
Sephy
  • 50,022
  • 30
  • 123
  • 131
192
votes
8 answers

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 like there is a public API to do this. any…
aryaxt
  • 76,198
  • 92
  • 293
  • 442
188
votes
4 answers

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? If so, what function do I have to use?
Christian
  • 25,249
  • 40
  • 134
  • 225