relativelayout

Android -- RelativeLayout and LinearLayout -- VideoView resize issue

I am having a video resizing issue, I have to build the layout programatically, and here's my code: layout = new RelativeLayout(this); top = new RelativeLayout.LayoutParams( LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT); top.addRule(RelativeLayout.ALIGN_PARENT_TOP); RelativeLayout.LayoutParams middle = new Relativ...

Android - How to change grey background created by a BitmapDrawable

I'm using the follow code, to create a non-scaled, centred image as a background, in a relative layout:- RelativeLayout explosionlayout = (RelativeLayout) findViewById (R.id.explosionlayout); explosionlayout.setBackgroundColor(R.color.white); Bitmap myBitmap = BitmapFactory.decodeResource(this.getResources(), R.drawable.bomb); Bitm...

Vertically Center TextView in RelativeLayout

In the image below, i want the textview in red to be vertically centered, I would like to keep using just RelativeLayout not any LinearLayouts, I think i can figure out how to do this with LinearLayout but do not want to use these. This is all based off of the examples i found here android devleper's blog - Android Layout Tricks #1 ...

Android RelativeLayout

Why doesn't it work? "First" overlapped "Second". What's wrong? protected View onCreateDialogView() { RelativeLayout layout = new RelativeLayout(mContext); RelativeLayout.LayoutParams mParams = new RelativeLayout.LayoutParams (LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); mFirstTex...

android RelativeLayout, trying to vertically center a TextView when the TextView below has no text

I have a ListView that contains an Image on the left of two vertically-oriented TextViews using a RelativeLayout. When both TextViews have text it looks fine. Sometimes the TextView on the bottom won't have any text, and the problem is that the entire layout is several pixels above where it should be because it still reserves that space ...

Issue with RelativeLayout when View visibility is View.GONE

Hi I've a RelativeLayout thus: <RelativeLayout> <TextView1/> <TextView2/> // <-- View.VISIBLE OR View.GONE <TextView3/> <TextView4/> </RelativeLayout> Each TextView is anchored below the previous TextView with android:layout_below. The problem is that TextView2 may or may not be there (either View.VISIBLE or View.GONE); if it's View...

Android relative layout placement problems

I have been having problems creating a relative layout in XML for a list item to be used for a series of items in a ListView. I have tried for hours and am tearing my hair out trying to get it to look how I want but cannot get everything to appear in the correct spot and not overlap or mis-align. I can get the first image and next two te...

Making code stuff pretty (layout)

So I have made a little piece of code that will insert and manipulate a few images. Now my main problem is that this is very ugly and long, I was wondering if anything could be done to make it prettier. RelativeLayout mRelativeLayout = (RelativeLayout) findViewById(R.id.board); ImageView i = new ImageView(this); i.setImageR...

Android - RelativeLayout CENTER_VERTICAL and BELOW issue

I want a TextView on top and a VideoView below it. I want to have the VideoView as center verical and below the TextView. I am using RelativeLayout. I am trying to do this in code: RelativeLayout layout = new RelativeLayout(this); TextView tv = new TextView(this); tv.setText("Hello"); tv.setGravity(Gravity.RIGHT); tv.setTextColor(Color...

android relative layout below 2 items

i have a relative layout like this: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/single_row" android:padding="12dip"> <ImageView android:id="@+id/page_image" android:layout_marginRight="6dip" android:l...

Android Scrollview in RelativeLayout with ButtonBar

I'm trying to implement a login view where several EditTexts and a logo are displayed on the screen with a ButtonBar at the bottom, something like this: The problem is that on very small screens, especially when they are rotated sideways, the entire main view doesn't fit onto the screen. I currently have <?xml version="1.0" encoding...

Spacing ImageButtons in Android

How do you space ImageButtons? With RelativeLayout, I can have them side by side but I want a gap between them. How do I place the buttons in the center and at the bottom of the screen? ...

Having issues with centering text in TextView within a region...

Hi, I'm having issues with TextViews and centering the text within the text region. Specifically, I have a TextView, but when I have text inside that contains letters that straddle down the bottom margin (i.e. p, g, q, y, etc), those letters are getting cut-off. I'm trying to center the text within the region but haven't had much luck...

Programmatically align a Text view in a RelativeLayout

I can't call setContentView to show XML layouts - I can only get a RelativeLayout which I can programmatically modify. Now, what I need to do is add a simple TextView, aligned at the bottom of that RelativeLayout. With XML it would be as simple as: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orient...

Button position in android

Hello, I'm trying to make some "Chat view" with speech bubbles like on the sms iPhone app. This is a row I done in the xml editor : http://img44.imageshack.us/i/xml.png/ But when I launch the my application, I get this : http://img59.imageshack.us/i/resultt.png/ I don't know why the button to answer is so far away my Relative layout ...

Android RelativeLayout - using multiple layout attributes

If you have two TextViews side by side each with a varying number of lines and then want a TextView below both of these how would you implement it? For example, if you had: <TextView android:id="@+id/textview1" android:layout_width="160dip" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:m...

Place a RelativeLayout at the bottom of a Relative layout, Android

I have a RelativeLayout, and this Layout has two childs, one is a MapView and the other a RelativeLayout that contains a button. I want it to look like that http://pocketjourney.files.wordpress.com/2008/03/goal.gif but my transparent box (a relativelayout) is always displayed at the top of the map. <RelativeLayout android:layout_wi...

dynamically adding a view to activity layout

I have a custom view (an extension of a TextView) that I want to dynamically add to my Layout (don't want to include it in the main.xml file). The book says to fetch the RelativeLayout using findViewById() in my java code then create a new instance of my custom view, then use addView on the RelativeLayout to add the new view. I'm not g...

clearing contents of a RelativeLayout programmatically - android java

I am dynamically adding ImageViews to a RelativeLayout depending on user input. I have also created a button that when pressed, should clear all of the content of that RelativeLayout (remove all children). I was hoping for a .clear() method, but no such luck. can someone point me in the right direction here? RelativeLayout rel = (Rel...

In a RelativeLayout how to prevent objects from piling up on eachother?

I'm starting to use RelativeLayout more and more but there are some things I keep running into. Say I have a status textview that I want top and center. Then I have a bunch of other objects below it like images and a table layout. I want the stuff below the status text view to respect the status textview's personal space and not draw...