Mark M. | has entered the room |
Mark M. | turned on guest access |
Oct 20 | 3:55 PM |
HighwayRob | has entered the room |
Mark M. |
hi, Rob!
|
Mark M. |
how can I help you today?
|
HighwayRob | |
Oct 20 | 4:00 PM |
Mark M. |
um, OK
|
Mark M. |
could you explain your issue?
|
HighwayRob |
Good afternoon Mark. The project I am workingon does not display the bottom half of the layout I uploaded. The TextView and ListView does not get displayed. Prety sure the data is getting set.
|
Mark M. |
wrap_content is not a good choice for height for ListView or TextureView
|
Mark M. |
in the case of TextureView, to a very real extent, there *is* no "content" on which to measure height
|
Mark M. |
in the case of ListView, the content is not determined until the adapter is attached, and that gets weird
|
Mark M. |
the TextureView width of wrap_content will have a similar issue
|
Mark M. |
so, my guess is that these widgets have a height and width of 0 pixels when you run this code
|
Mark M. |
wrap_content is fine for TextView (and children, like Button), ImageView, CheckBox, etc.
|
Mark M. |
but for other widgets -- ListView, TextureView, RecyclerView, etc. -- wrap_content won't work for height or width especially well
|
Mark M. |
instead, you either use match_parent, a specific dimension, or use other layout rules to size things
|
HighwayRob |
Let me try match_parent to see if anything get displayed.
|
Mark M. |
at most, the first ListView might
|
Oct 20 | 4:05 PM |
Mark M. |
that would take up all the rest of the space on the screen
|
Mark M. |
leaving no room for the TextureView or second ListView
|
HighwayRob |
First listview does get displayed, then nothing.
|
Mark M. |
since your root view is LinearLayout, you could use layout_weight to allocate space proportionally
|
Mark M. | |
Mark M. |
that link is to a layout from the book's chapter on the classic containers, like LinearLayout
|
Mark M. |
it has three buttons, vertically stacked
|
Mark M. |
the buttons take up 50%, 30%, and 20% of the space, respectively from the top
|
Mark M. |
that's because I set their height to be 0dp and set their weights to be 50, 30, and 20
|
Mark M. |
each button gets space allocated based on its weight compared to the total weight, so the first button gets 50/(50+30+20) = 50/100 = 50% of the space, and so forth
|
HighwayRob |
Cool, let me give that a quick whirl.
|
Mark M. |
if you were using ConstraintLayout as the root container, you could use guidelines or percentage-based constraints to achieve a similar effect
|
Oct 20 | 4:15 PM |
HighwayRob | |
Mark M. |
OK, what do you not like?
|
HighwayRob |
ok....list shows, the Textview appears black. I had a String set for "Your Favorite Drinks" in the string file, but it does not display.
|
Mark M. |
you don't have a TextView in that layout
|
Mark M. |
you have a TextureView in that layout
|
HighwayRob |
LOL
|
Mark M. |
TextureView is for displaying things like videos, OpenGL animations, etc.
|
HighwayRob |
OK..works now. I am laughing. I looked at that for hours and never saw that. If I had saw that, it probably would of worked.
|
Mark M. |
it's easy to make that sort of mistake, particularly if you are using code-completion assistance in the IDE
|
Oct 20 | 4:20 PM |
HighwayRob |
View paste
|
Mark M. |
go right ahead
|
HighwayRob | |
HighwayRob |
View paste
|
HighwayRob |
This line lights up in red and I get error message:
|
HighwayRob |
D:\DroidStructSysV216\DroidStructSysV216\hilightsTechMan\hilightsTechMan\build\intermediates\res\merged\debug\values\com_crashlytics_build_id.xml: error: uncompiled XML file passed as argument. Must be compiled first into .flat file..
|
Mark M. |
the file you have up in the editor is from the build/ directory
|
HighwayRob |
Three layout files reference http://schemas.android.com/tools
|
Mark M. |
error messages that you see in in the IDE for build/ files are sometimes meaningless
|
Mark M. |
in this case, the "URI is not registered" message is benign
|
Mark M. |
you always get that when looking at build/ output, and I don't know why
|
Mark M. |
it's not indicative of a problem
|
Oct 20 | 4:25 PM |
Mark M. |
the error message "Must be compiled first into .flat file" is coming from your build output (Gradle console), right?
|
HighwayRob |
yes
|
HighwayRob |
View paste
|
Mark M. | |
Mark M. |
try that and see if it helps
|
HighwayRob |
in gradle-wrapper.properties ?
|
Mark M. |
no, there should be a gradle.properties file in your project root directory
|
Mark M. |
if not, create one there and put that line in it
|
Oct 20 | 4:30 PM |
HighwayRob | |
HighwayRob |
At what level does it go?
|
Mark M. |
as a peer of settings.gradle, local.properties, etc.
|
Oct 20 | 4:35 PM |
HighwayRob |
well...it compiled but did not run in emulator, I will try attaching my phone (production APP, hope it works).
|
Oct 20 | 4:40 PM |
HighwayRob |
View paste
|
Mark M. |
well, FWIW, I haven't used Crashlytics
|
Mark M. |
you're still getting that same error message, though?
|
HighwayRob |
yup
|
HighwayRob |
cleaned, rebuid, etc. same err.
|
Mark M. |
ummm... you may also need to stop the Gradle daemon for that change we made to take effect
|
Mark M. |
quoting from https://developer.android.com/studio/build/grad..., " If you are experiencing issues while using AAPT2, you can disable it by setting android.enableAapt2=false in your gradle.properties file and restarting the Gradle daemon by running ./gradlew --stop from the command line."
|
Mark M. |
completely closing and reopening Android Studio may also be sufficient to restart the Gradle daemon
|
HighwayRob |
ok, easier.
|
Oct 20 | 4:45 PM |
HighwayRob |
Same error come up automatically and the Gradle COnsole also says
|
HighwayRob |
View paste
|
Mark M. |
"...and the Gradle COnsole also says" what? the FAILURE message above that statement?
|
HighwayRob |
View paste
(83 more lines)
|
Mark M. |
Caused by: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
|
Mark M. |
so, our change did not yet take effect
|
Mark M. |
Option #1: open up a command prompt, navigate to your project root directory, and run ./gradlew --stop
|
Mark M. |
Option #2: reboot
|
Oct 20 | 4:50 PM |
Mark M. |
the Gradle daemon does eventually shut down when you stop Android Studio AFAIK, but I haven't examined the timing in detail
|
Oct 20 | 4:50 PM |
HighwayRob |
View paste
|
HighwayRob |
Rob
|
Mark M. |
OK
|
HighwayRob | has left the room |
Oct 20 | 5:00 PM |
Mark M. | turned off guest access |