android


GridLayout spitting out “inconsistent constraint” debug-level logs


I've been using GridLayout for a few weeks now and I've noticed that when I call
gridLayout.requestLayout()
it spits out the following debug-level message in LogCat:
D/android.widget.GridLayout(14048): horizontal constraints: x5 - x0 > 1115, x5 - x4 < 221, x4 - x3 < 221, x3 - x2 < 221, x2 - x1 < 221, x1 - x0 < 221 are inconsistent; permanently removing: x5 - x4 < 221.
I've looked through the source of GridLayout to try and find out the possible reason as to why the "contraints are inconsistent", but I haven't been able to figure it out.
The fact that these messages are appearing - is this something that I should be concerned about? I don't see any issues with the way things are being laid out. I have a GridLayout in Fragments that are loaded as the pages in a ViewPager so I as the user scrolls between the pages I see the above output in LogCat multiple times.
From the GridLayout source:
Bellman-Ford variant - modified to reduce typical running time from O(N^2) to O(N)
GridLayout converts its requirements into a system of linear constraints of the form:
x[i] - x[j] < a[k]
Where the x[i] are variables and the a[k] are constants.
For example, if the variables were instead labeled x, y, z we might have:
x - y < 17
y - z < 23
z - x < 42
This is a special case of the Linear Programming problem that is, in turn, equivalent to the single-source shortest paths problem on a digraph, for which the O(n^2) Bellman-Ford algorithm the most commonly used general solution.
It has a solve method that is using linear programming to guarantee the consistency of the constraints it has to satisfy, given its configuration. You can probably improve your layout performance if you figure out which configuration is associated with the constraint x5 - x4 < 221 and remove it. Then the solver won't have to solve that it can't be satisfied and remove it itself.
I had the same issue and I found that I missed to add XML namespace. Corrected it in this way:
<android.support.v7.widget.GridLayout
xmlns:grid="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android">
...
</android.support.v7.widget.GridLayout>
Then changed prefix of attributes used by compatibility GridLayout with XML namespace too:
<ImageButton android:id="#+id/btnSentence"
grid:layout_row="0"
grid:layout_column="0"
...
/>
and it helped... Hope it helps you too.

Related Links

Listview can't displayed the last item
Database value store in variable, cannot used by listview?
additonal line space in textview
android best way to load video from RSTP?
SQL statement producing data I do not want
android verify subscription validity from app every time (dayli) online and offline without a personal server
Google Map getMapAsync() NullPointerException
Error during creating dialog inside onDestroy : Can not perform this action after onSaveInstanceState Android
Android studio which version is good for development?
Unable to create GridView element in layout
Android Error parsing package - partial download
AdMob dont display Ads with my code
Android media player won't start
android Toolbar view in MainActivity
Cordova plugin-qrscanner no video preview
JNI FindClass called with pending exception java.lang.ClassNotFoundException: Didn't find class “net.sqlcipher.database.SQLiteDatabase”

Categories

HOME
gpu
rdbms
grafana
ms-access-2016
newrelic
switch-statement
square
azure-container-service
jquery-ui-sortable
php-5.6
pybossa
dynatrace
modbus-tcp
glyphicons
google-picker
google-container-registry
nodemcu
sar
aggregation
epsilon
android-maps
winpe
kudu
complex-numbers
git-squash
memory-address
dsx-desktop
python-pptx
apic
playframework-2.1
xv6
glm-math
logback-groovy
bindingnavigator
plan-9
launchctl
insight
tinkerpop
filehandle
arules
visual-studio-2008-sp1
jboss-tools
jquery-jscrollpane
expectations
omniauth-facebook
cda
yajsw
database-relations
np-spring
httpruntime.cache
ascii-art
highland.js
sony-lifelog-api
dulwich
vacuum
telepat
zend-currency
grouping-sets
infosphere-spl
mruby
metatrader5
strawberry-perl
xml-namespaces
cuba
dsym
high-resolution
code-duplication
printdialog
hidapi
neos-server
bjyauthorize
boost-msm
wcf-configuration
correlated-subquery
objectquery
database-create
httponly
google-floodlight
unattended-processing
object-database
folding
pos-for-.net
sifr
pagemethods
murmurhash
int64
commercial-application

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