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

Toolbar layout doesn't match parent width
How to set default theme for LatinIME in AOSP
Accessing Android Root Privileges Without Having To Root The Phone
Prevent Android Phone from shutting down on long power button press
How can i pass item position from onItemLongClick to another class?
How to send many OneSignal.postNotification, send in bunch or individual?
How do swipe or scrollIntoView with collapsing toolbar?
Firebase Getting the Key of a Child
Android Studio Connect To SQL Database - Oracle
Android Jack error -no mapping specified for register
Fetching analytics related to push notification in `FCM Cloud Messaging`
Can't receive rtsp stream on android
Android OpenGLES w Intent/BroadCastReceiver
Android N_Perform the fingerprint matching in a (TEE) or on a chip with a secure channel to the TEE
Possible to add Section Header From Server In Listview With Swipe to Delete and Undo a item
How to store user data using Firebase in Android?

Categories

HOME
polymer
eslint
linkedin
zend-framework
apache-spark-mllib
camera
r-googlesheets
rendering
replace
pdfbox
entity-framework-core
soa
nested-if
echo
pearson-correlation
x264
syntaxnet
ycsb
flash-player
modbus-tcp
azure-iot-hub
glyphicons
chargify
symfony-console
asp.net-core-webapi
guzzle
squashfs
imageresizer
xunit
google-api-client
pylons
nstimer
openmdao
winpe
eviews
code-snippets
login-script
html-encode
browser-extension
watchman
zoomify
dm-script
cd
password-protection
linq-to-objects
chef-solo
movilizer
claims
knime
xmldocument
apache-spark-dataset
optimizely
cnc
robomongo
dotnet-httpclient
wcftestclient
tinymce-3
er-diagram
pdf-conversion
type-theory
gameplay-kit
ampps
greatest-n-per-group
gogs
stream-processing
contentcontrol
concurrentmodification
opl
r-package
dllimport
rubaxa-sortable
sapscript
mod-proxy
jsvc
aspectj-maven-plugin
matlab-deployment
diff3
dbaccess
angular-gettext
psr-4
cbind
personalization
malformedurlexception
menubar
conditionaltagsupport
ecslidingviewcontroller
eclipse-kepler
light
scrypt
node-blade
pagedown
android-sdk-2.3
wimax
mkv
pyunit
listitem
appjs
ilasm
stress
cgimage
workflow-services
filemerge
u2netdk
drawtobitmap
qglwidget
folding
tui
software-lifecycle
soappy
pnrp
netbeans6.1

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App