开发者

State List drawable does not show up in all screens

开发者 https://www.devze.com 2023-03-17 02:15 出处:网络
I have a drawable named btndonate.xml <?xml version=\"1.0\" encoding=\"utf-8\"?> <selector xmlns:android=\"http://schemas.android.com/apk/res/android\"

I have a drawable named btndonate.xml

 <?xml version="1.0" encoding="utf-8"?>
   <selector xmlns:android="http://schemas.android.com/apk/res/android"
android:constantSize="true" android:dither="true"
android:variablePadding="true"
>
<item android:drawable="@dr开发者_JAVA技巧awable/donate_hover"
    android:state_pressed="true" />
    <item android:drawable="@drawable/btn_donate"
    android:state_window_focused="true"  />
<item android:state_focused="true" android:drawable="@drawable/donate_hover"> </item>
<item android:state_focused="false" android:drawable="@drawable/btn_donate"></item>

</selector>

I am using it in activity's xml like

        <Button android:layout_centerInParent="true"
            android:layout_width="wrap_content" android:layout_height="wrap_content"
            android:background="@drawable/btndonate" android:id="@+id/btn_home_donate"></Button>

i am using the same button with different id's in my other activities xmls.. but it shows up in some and hidden in others i dont know y the same button does not show up n all my activities though the drawable is same for all of them .. ??

any one plz help ??


That's odd... Are you sure, you didn't make any mistakes? Do you use the same xml file for your script?

Try using this:

Button anyButton = (Button) findViewById(R.id.anyButton);
anyButton.setVisibility(View.VISIBLE);

Hope this helps. Don't forget to mark correct when it works. ;)

0

精彩评论

暂无评论...
验证码 换一张
取 消