Missing/Hidden/Dissappearing Button problem

by Tollas » Sat, 29 May 2010 01:43:20 GMT


Sponsored Links
 <Button
   android:id="@+id/attack_ability_button"
   android:layout_width="52dp"
   android:layout_height="52dp"
   android:layout_x="10dp"
   android:layout_y="70dp"/>

final Button attack_ability_button =
(Button)findViewById(R.id.attack_ability_button);
attack_ability_button.setBackgroundDrawable(getResources().getDrawable(R.drawable.attack_any));


My problem is that when I use the attack_any  drawable to create the
button, it just isn't there.
If I change to another image of the same size, the button shows up
just fine.
I've tried replacing the image file, renaming it, resizing it. Always
with the same results.
I tried using the attack_any drawable for another button and it
disappears as well.
I've also tried moving the button and changing its size, but the
problem persists.
I've even tried drawing the background in XML rather than java and it
still will not show up.

attack_any.png is a 60x60px image 1kb in size.

Scroll View
-----Absolute Layout

--



Missing/Hidden/Dissappearing Button problem

by Justin Anderson » Sat, 29 May 2010 01:58:15 GMT


 Is it there and you just can't see it?  Or is it not there period?  What
happens if you click where the button is supposed to be at?

One other thing I noticed... You are using AbsoluteLayout.  That has been
deprecated and it will not play nice with phones that have different screen
sizes.

----------------------------------------------------------------------
There are only 10 types of people in the world...
Those who know binary and those who don't.
----------------------------------------------------------------------





>


Sponsored Links


Missing/Hidden/Dissappearing Button problem

by Tollas » Sat, 29 May 2010 02:22:40 GMT


 The button is there. I can click on it and it behaves normally.
I have a Spinner onItemSelected that updates the button's image.
When I activate that & set to any value but the default, the button
updates properly and the new image is displayed.




> >



Missing/Hidden/Dissappearing Button problem

by Tollas » Sat, 29 May 2010 04:07:47 GMT


 Yes.
(getResources().getDrawable(R.drawable.attack_any) != null) returns
true.






> > > >



Missing/Hidden/Dissappearing Button problem

by niko20 » Sat, 29 May 2010 21:14:31 GMT


 i,

Are you using a relative layout at all? Relative layout has some bugs
when you use "forward references", and basically will "disappear".

-niko

On May 28, 3:07pm, Tollas <tolla...@gmail.com> wrote:
> > > > >



Missing/Hidden/Dissappearing Button problem

by Tollas » Sun, 30 May 2010 10:14:47 GMT


 o. I have a single AbosoluteLayout nested in a single ScrollView.

<ScrollView
android:id="@+id/scrollview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android">

<AbsoluteLayout
android:id="@+id/mainlayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent">

On May 29, 8:14am, niko20 <nikolatesl...@yahoo.com> wrote:
> > > > > >



Missing/Hidden/Dissappearing Button problem

by Tollas » Sat, 05 Jun 2010 14:50:09 GMT


 k. Tried switching to RelativeLayout and I'm still having the same
problem.

On May 30, 2:31am, Justin Anderson <janderson....@gmail.com> wrote:
> > > > > > > >



Missing/Hidden/Dissappearing Button problem

by Tollas » Sun, 06 Jun 2010 00:18:20 GMT


  can't remember why. I tried changing the button size to 60x60 with
the same results.

On Jun 5, 4:06am, Justin Anderson <janderson....@gmail.com> wrote:
> > > > > > > > > >



Missing/Hidden/Dissappearing Button problem

by Tollas » Sun, 06 Jun 2010 00:23:00 GMT


  can't remember why. I tried changing the button size to 60x60 with
the same results.

On Jun 5, 4:06am, Justin Anderson <janderson....@gmail.com> wrote:
> > > > > > > > > >



Missing/Hidden/Dissappearing Button problem

by Gubatron » Sun, 06 Jun 2010 04:48:12 GMT


 Did you try passing the drawable on the Button XML?

... android:background="@drawable/attack_any" />

or you can only obtain the drawable at runtime? (dynamic drawable)




--



Missing/Hidden/Dissappearing Button problem

by Tollas » Sun, 06 Jun 2010 06:55:24 GMT


 Yes, I have tried that. Same result.
I've also tried making it an ImageButton and ImageView with the same
result.





--



Missing/Hidden/Dissappearing Button problem

by Tollas » Mon, 07 Jun 2010 09:11:39 GMT


 I have no idea why, but changing the file name to anything that
doesn't begin with the letter "a" seems to work. I had tried different
file names, but all of them began with a.
I don't have any idea why this would affect anything. I have other
files the same size (both in pixels and in kb) that begin with "a"
that work just fine.

I guess since as a user the file name doesn't matter, it's not that
big of a deal, but it would be nice to know why!






--



Missing/Hidden/Dissappearing Button problem

by Tollas » Mon, 07 Jun 2010 10:23:01 GMT


 And this also broke another image. Fixing that one by changing the
name broke a 3rd image. Fixing that broke a 4th. Changed all 4 image
names and now all work properly.







--



Other Threads

1. Idea Conceptualization

Hey,

I am planning to make an android based application which logs either the
entire history or some part of the history of the last ip addresses used to
access Google accounts.

I did try searching on the internet but that did not result into anything
fruitful.

Is this possible ? A few links or Read up API's would be appreciated. :)

Thanks.
--
Cuil

-- 

2. Android WebView with CSS modification of hr tag

I am working on an app which needs to display some dynamically queried
HTML content, including CSS.
WebView seems to be the best implementation for this type of work.

I ran into an error when testing it out, and tracked it down to the
following css tag:

hr{width:100%!important}


Android WebView seems to be incapable of displaying any html that
includes this line.
Some research shows that the <hr width=100%/> attribute was depricated
(link: http://www.w3schools.com/tags/att_hr_width.asp), but it works
on all browsers.

Below is some html, including this line.  It will render fine in any
browser.

<html><head><style type=\"text/css\">
hr{width:100%!important}
</style></head><body>
Some text
</body></html>


And, in Android:

                String exampleCSS = "<html><head><style type=\"text/css\">" +
                                "hr{width:100%!important}" +
                                "</style></head><body>" +
                                "Some text" +
                                "</body></html>";
                WebView webView = (WebView) findViewById(R.id.web_html_about);
                webView.loadData(exampleCSS, "text/html", "utf-8");


The result is a "Web page not available" error in the webview.


Is this a known issue due to deprecation?  Is it a bug with WebView?
Is there any known work around for such issues?

Cheers,
Dale.

-- 

3. Can this app be developed?

4. adding custom view in main.xml

5. Killer App Android? (Was: WTI: Sprint integrates Google Voice)

6. solar tracking system using android OS

7. Need help to upgrade android2.1 to 2.3 on Samsung 6410 CPU