Android :: A SurfaceView And 2 Buttons On A Layout Cannot Be Displayed?
Jun 6, 2009
I have a simple problem which makes me feel like a stupid. I really need help on this.
I have a SurfaceView which I created with Java code not XML. I created a MediaPlayer which shows its content on that SurfaceView.
When I use, setContentView(mPreview); // where mPreview is a SurfaceView
The video is played on the screen.
I need to add two buttons on the screen. So I tried something like this:
code:.........
This did not change anything. Still the video is displayed on full screen and no buttons appear. I am a java programmer both SE and ME. Things are done in this way on Java.
Does Android have a different approach?
View 4 Replies
Nov 1, 2009
Our application displays widgets that update every minute through Alarm. It works fine under 1.5 and 1.6 but since 2.0, widget is not displayed at all. Only initial layout is displayed.
View 2 Replies
View Related
Mar 22, 2009
How can I place widgets such as buttons on top of a SurfaceView (Video). According to the reference this should be possible. But I have no idea how the xml file should look like.
View 2 Replies
View Related
Jan 23, 2009
Is it possible to build a GridView object in XML with 3 columns and 4 rows of Image buttons? It doesn't seem to have similar containment relationship like LinearLayout or RelativeLayout viewgroups.
I want to do this entirely in an xml layout file. When I put ImageButton xml tags inside a GridView xml body, The layout panel in eclipse is throwing an exception: UnsupportedOperationException:addView(View, LayoutParams) is not supported in AdapterView.
View 2 Replies
View Related
Apr 19, 2010
My application should hold a camera preview surface. The camera is fixed to landscape view via AndroidMainfest.xml I am quite new to the Android plattform programming. Of course I don't know much about the programming tricks and workarounds yet. I did a lot of research over the last two weeks (even studied the native Camera implementation), but couldn't find a good solution so far.
View 2 Replies
View Related
Jun 5, 2010
I'm very new to Android programming, so this is probably something pretty basic. I just have an xml layout with a few buttons. I'm trying to follow the model given by the JetBoy demo, so I'm adding a view to the layout which extends SurfaceView. When this new view is put in my xml layout, I just get a blank screen.
Here's the XML layout if it helps. The gameview element is what causes the screen to be blank
CODE:......................
View 2 Replies
View Related
Sep 8, 2010
I have the following situation. Attached is a snippet of code that appears in the OnCreate of my Activity.
CODE:..........
The issue is that my layout never gets displayed until the OnCreate method has compoleted. Since my 3 functions takes about 10 secs to complete, I have a blank screen being displayed for 10 secs. This layout has a progress bar which meant to show the progress thru each function.
View 4 Replies
View Related
Aug 13, 2009
I am trying to display a bunch of image icons in a grid view, with some basic inductive text on the top. This layout is inside a tab pane. For some reason my application just Fore closes without any stack trace when I do this. Here is my lay out file and the corresponding code that uses it in a tab.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/ android" android:id="@+id/welcomeLayout" android:orientation="vertical"> <TextView android:id="@+id/txtWelcome" text="@string/app_name" > </TextView> <GridView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:padding="10dp" android:id="@+id/welcomeGrid" android:horizontalSpacing="10dp" android:numColumns="auto_fit" android:stretchMode="columnWidth" android:gravity="center" android:columnWidth="120dp" android:verticalSpacing="15dp"/>
</LinearLayout>......
View 3 Replies
View Related
Jan 27, 2010
Currently, I have a layout which contains a Button, a TextView and an EditText. When the layout is displayed, the focus will be automatically put on the EditText, which will trigger the keyboard to show up on Android phone. It is not what I want. Is there any way that I can set the focus on TextView or on nothing when a layout is displayed?
View 6 Replies
View Related
Apr 22, 2010
I am trying to laod the listview dynamically. There are three textviews inside a listview. The text to be set in the textview is fetched from the server. All this is working fine. I am able to fetch the text and am able to display it inside the listview.
The only problem is the position of the textview. The xml layout file is as under:
CODE:.............
If I look at this xml layout in the eclipse layout tab then it is displayed properly. Problem occurs only when the text is fetched dynamically.
View 2 Replies
View Related
Jul 14, 2012
I am using:
Android 4.0.3
OpenCV 2.4.2
Samsung Galaxy S2
The face-detection example (from the opencv 2.4.2) is working perfectly. But now, I would like to create a custom layout and actually work with just the data extracted from face detection and build a game on it. Not necessarily having the FdView surface taking the entire screen.
I have done these modifications below, but just a black screen is displayed. Nothing appears on the screen.
Changed the BaseLoaderCallback in FdActivity.java
Code:
//EXPERIMENT
setContentView(R.layout.fd);
FdView surface = (FdView) (findViewById(R.id.FdView));[code]....
View 2 Replies
View Related
Aug 20, 2010
One using a Surfaceview, and the other using a custom view. According to the android SDK development guide, using a surface view is better because you can spawn a separate thread to handle graphics. Th SDK development guide claims that using a custom view with invalidate calls is only good for slower animations, less intense graphics.However, in my simple app, I can clearly see that using a custom view with calls to invalidate seems to render faster.What do you guys know/think about this?My touchEvent code is exactly the same, and my drawing code is exactly the same. The only difference is that one is all in the UI thread, and the other is using a tread to handle the drawing.
View 1 Replies
View Related
Apr 22, 2010
CODE:...................
This is the layout that I am inflating in the Adapter. Everything is displayed, but only the second textview which should be displayed at the bottom is getting displayed at the top. Can someone let me know the problem with this?
I I view this in the layout tab in Eclipse then it displays properly. The problem occurs only when the text is fetched dynamically.
View 1 Replies
View Related
Feb 8, 2010
I tried so many things to relocate buttons of a list. Relocate the current button is working but the older buttons not. To clarify the situation:
There are two Activities (Activity A and B). At Activity A I customize a button and pass it on Activity B via an intent. On Activity B I move the button somewhere on the screen. This will be done with other buttons. On Activity B I also want to show the old Buttons.code..
As above mentioned, I want to move the Buttons and set them somewhere on the screen (e.g. down right). But everytime I call Acitvity B again, all Buttons are located at top left. I thought it would be achieved with .
View 15 Replies
View Related
Nov 17, 2010
I want to create layout like this on facebook app. Тo appear with effect from bottom to top.I don't know where to find example (xml and code) for this.
View 2 Replies
View Related
Aug 9, 2010
I am trying to make my layout look like so. I have tried gridviews, table layouts, and more but cant get it to look right. I want something like this.
CODE:........
I just cant seem to figure out how to get the layout to work with imagebuttons. What layout should I use? And could you post example code of the xml layout if possible?
View 2 Replies
View Related
Jun 1, 2010
I want to make a layout similar to this one:
Four square buttons on the screen - each of those using half of the screen with/screen height (whichever is smaler). Independent of screen size/resolution.
I already tried to achieve this by using a LinearLayoutbut the buttons are ending up using the correct width, but still having the height of the background (not square any more).
CODE:..........
It's looking like this:
How can i acchieve the Layout to look like the image at the top above?
View 2 Replies
View Related
Mar 13, 2010
I want there to be buttons at the bottom of the screen, but if the screen size is larger, more buttons would be added.
For example, at a small screen size, there might be 4-5 buttons at the bottom, but if you ran it on a tablet or something similar, there would be maybe 20 buttons.
It can't scroll either, it just has to dynamically fill the layout with buttons.
View 3 Replies
View Related
Mar 5, 2010
This specific layout is just annoying me. And can't seem to find a way to have a listView, with a row of buttons at the bottom so that the listview doesn't extend over top of the buttons, and so the buttons are always snapped to the bottom of the screen.
Here's what I want:
It seems like it should be so easy, but everything I've tried has failed.
Here's my current code:
CODE:..........
View 7 Replies
View Related
Sep 21, 2010
I'd like to add a transparent panel (relativelayout) with fill_parent in width and height.
I want to use this "glasspane" in order to block all buttons underneath. Unfortunately I cannot find the right setter / xml attribute for this.
These wont work:
.setEnabled(false); .setPressed(false); .setClickable(false); .setFocusable(false); .setSaveEnabled(false); .setSelected(false);
Maybe its better to understand if I tell you that I want to create my own dialog without extending the class Dialog.
A dialog also puts a transparent glasspane above all and absorbs all clicks underneath...
View 3 Replies
View Related
Aug 18, 2010
RelativeLayout is more flexible, and can do what AbsoluteLayout can do and more.
http://developer.android.com/reference/android/widget/RelativeLayout....
To place views on top of one another you can also use FrameLayout, positioning these frame layouts in their parent layout:
http://developer.android.com/reference/android/widget/FrameLayout.html
18.08.2010 19:11, ericmahlon пишет:
> I have an image that will have 5 different areas that will be "clickable." Each clickable area will be invisible and play a different sound. I was told not to use an absolute layout, and use a linear layout instead. However, I am now having an issue with placing the buttons over the picture. The linear layout does not allow me to position them correctly where they need to go. How do I properly position a button so that it is over a certain part of the image?
View 3 Replies
View Related
Apr 8, 2010
I have this layout that works correctly, a relative layout with a text view and two buttons spaced evenly below it.
CODE:........
But running layoutopt it says that "this TableRow layout or its TableLayout parent is possible useless".
Is there a way to do this layout then without the tables?
View 1 Replies
View Related
Oct 12, 2010
I have three buttons defined in xml
CODE:..............
In Java one way to listen to them is:
CODE:.............
For second btn , same code has to be repeated with different id? How can I make it generic enough that , it can listen to all buttons (say in for loop) and while handling I should be able to differentiate different btns. (may be get elements id)
View 2 Replies
View Related
Sep 25, 2010
I've got the following layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<WebView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button android:id="@+id/back"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:text="Back" />
<Button android:id="@+id/page_number"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:text="1 / 100" />
<Button android:id="@+id/next"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:text="Next" />
</LinearLayout>
</LinearLayout>
Which results in the following. How do I make the buttons fit the screen and stop the WebView pushing them off?
View 1 Replies
View Related
Nov 21, 2010
I can write a widget with a Button or ImageButton and assign a StateDrawable as background or sourcein order to make an effect when you click it. Besides that I have problems with the side of each button, my main problem is this: how do I change the StateDrawable if I want to change the image of the button from the AppWidgetProvider but still want to preserve the click effect like a StateDrawable. The power control widget in Android does things like that.
View 2 Replies
View Related
Jan 26, 2009
I am probably missing something totally obvious, but can someone tell me how to add padding between buttons of a Linear Layout?
Code...
View 5 Replies
View Related
Mar 12, 2010
I have a vertically orientated Linear Layout with some Buttons in it:
<Linear Layout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical">
<Button android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@+id/bt1" android:text="Button 1"></Button>
<Button android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@+id/bt2" android:text="Button 2"></Button>
<Button android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@+id/bt3" android:text="Button 3"></Button>
<Button android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@+id/bt4" android:text="Button 4"></Button>
View 2 Replies
View Related
May 2, 2010
I am trying to build a layout dynamically which display some text and image for the most part, but has a series of buttons placed next to each other in the bottom. I have a linear layout that carries the text, another linear layout that carries the image. And yet another linear layout that carries the buttons that get created in a for loop. I have a main layout aligned vertical that adds the text, image and buttons layout, in that order. To finally generate something like this: Text Image Button1 Button2 Button3. The problem is the number of buttons get decided at runtime, so if there are more than 4 buttons, the 5th button gets displayed really tiny. Also, when I tilt the phone, I get only the text and image showing, but no buttons because the image covers the entire screen. Layout thing seems to be pretty complicated to me, any help is appreciated!
View 1 Replies
View Related
Sep 16, 2009
My application has some buttons in the bottom part of activity layout, almost the same like iphone has on ipod app for example. I would like to create my layout so that it will self adjust on different screen sizes.
For example if the content in my layout has height = 400dip and the menu bar in the bottom has height = 100 dip, on every screen size (240*320, 320*480 etc.) i would like the menu bar to stay at the bottom so :
- on screen size 240*320 -> 100dip - for menubar -> 220dip - for content => it remains 180 dip to show, so this content area should be in some kind of a scrollview so that i can view 400dip in only 220dip.
I have tested different possibilities, with relativelayout so that the menu bar could stay on bottom, but i could not put the scroll view on top so that the scroll appears only on small screen sizes.
This is so sick, how do you build your layouts for different screen sizes ?
View 8 Replies
View Related
Oct 30, 2010
I would like to have a layout with 5 times 5 buttons. Each of them should have the same width and height (they should be square). And I want the whole matrix to use the screen width (or height, depending on rotation).
I currently do it "by hand" in the Java code:
CODE:...........
This can be improved by obtaining screen width first and then dividing by 5 to get rid of this literal 60. But I'm wondering how I can do this in the res/layout XML file? How can I specify for the height to be the same as the width? (I can set the width to match_parent.)
View 4 Replies
View Related