android


Android RelativeLayout Background Color


For a long time I am reading posts from stackoverflow because they are very helpful and google seems to think that also.
Since yesterday I have a problem with a row in a ListView in Android. I want to show an image and the area between the image and the bottom of the element should be filled with a grey color.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<RelativeLayout
android:id="#+id/ConversationsBadgeLayout"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="#c0c0c0"
android:orientation="vertical" >
<QuickContactBadge
android:id="#+id/ConversationsBadge"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true" />
</RelativeLayout>
<!--
...
A LinearLayout with TextViews, shouldn't be interesting for this
...
-->
</RelativeLayout>
My Problem ist that the it seems that the inner layout only wraps the content but doesn't fill_parent. When I set for example 100dp it works but that is not what i want.
It would be nice if you could help me with that. I tried much workarround like using LinearLayouts and TextViews but nothing worked.
You can set the background color to the ListView itself, then everything in it will have the background you want.
BTW, I recommend using LinearLayout instead of RelativeLayout in your case.
The layout file should contain exactly one outermost element and it should have both android:layout_width="match_parent" and android:layout_height="match_parent" Your RelativeLayout has android:layout_height="wrap_content"
i think you can use you can take background color in another xml file and put in drawable folder and also using Linear Layout is very useful to your problem

Related Links

How do I send a custom file type using Intents?
Develop an sdk in android
android how to create a try it yourself editor
Is there any way to upload application automatic for Android Market?
How to rotate picture on google map in android ,
Android Image captured force close
Handle main commands in android native activity
Android Spinner in a dialog give this error android.view.WindowManager$BadTokenException: Unable to add window
Android: BitmapFactory.decodeStream() out of memory with a 400KB file with 2MB free heap
Android video test automation
Get my Application Activity-Stack
Unable to instantiate activity ComponentInfo- super()
Android FragmentStatePagerAdapter, how to tag a fragment to find it later
GoogleAdView - can't install in Eclipse
Android not appearing in Eclipse -> Preferences (OS X 10.5.8)
Getting errors in android development “R cannot be resolved to a variable” and in layout also

Categories

HOME
django
kentico
deep-learning
awk
cheerio
wakanda
webdriver
twig
depth
zend-framework
requirements
devise
spring-data-redis
tvos
iis-6
mvc5
vert.x
pkcs#11
dkim
pega
line
filechannel
internationalization
scsi
aws-sdk
feathersjs
asp.net-mvc-viewmodel
database-connection
replication
spring-async
dpdk
visual-studio-extensions
mongoid6
xcode-ui-testing
flooding
handler
corenlp-server
recurring-events
cognos-bi
biztalk-rule-engine
baidu-map
sql-server-ce
recurrent-neural-network
gdata
kill
magento-1.9.3
android-ibeacon
facebook-social-plugins
httrack
mongotemplate
pair-programming
ampps
pure-css
latin
lrs
cortex-m
ellucian-scribe
opl
dllimport
xenomai
video-player
rpart
snackbar
user-permissions
rrule
pseudo-class
linkedin-jsapi
rcaller
conditionaltagsupport
embedded-fonts
observium
route-provider
kaleidoscope
facebook-timeline
android-sdk-2.3
pdfviewer
zope.interface
usertype
google-maps-mobile
agility.js
entitydatasource
creole
w3c-geolocation
photolibrary
ie-compatibility-mode
facebook-iframe
maven-1
request-headers
interop-domino
wspbuilder
great-circle

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App