Reputation: 593
i have a layout xml which has 16 image button.
one png image which is declared in that layout does not show in activity.(only android 2.2 / 2.3) when i add dummy image in drawable, strangely enough, previous image will be gone. (when two dummy image, two before image will be gone...) in eclipse graphical layout, i can see the image of disappeared on android phone.
i already checked R file has a declaration of disappeared image. Does anyone know about what's going on about this issue?
i would appreciate your support.
For example in code following... ImageButton which tag is 3 is not showing on screen, not even clickable. but when i add dummy button such as button_999, that actually not used in app, then the ImageButton with tag 2 is disappeared and ImageButton with tag 3 is showing this time. if i add one more dummy button like button_998, then ImageButton with tag1 will disappear.
here is the style
<style name="layoutStyle">
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:orientation">horizontal</item>
<item name="android:layout_marginRight">3dip</item>
<item name="android:layout_marginLeft">3dip</item>
<item name="android:baselineAligned">false</item>
</style>
<style name="buttonStyle">
<item name="android:layout_width">0dip</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_weight">1</item>
<item name="android:adjustViewBounds">true</item>
<item name="android:background">#00000000</item>
<item name="android:scaleType">centerInside</item>
<item name="android:padding">2dip</item>
<item name="android:onClick">onClick</item>
</style>
and layout file
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<LinearLayout
style="@style/layoutStyle"
android:layout_marginTop="8dip">
<ImageButton
style="@style/buttonStyle"
android:tag="1"
android:contentDescription="@string/contentDescription"
android:src="@drawable/button_selector_1"/>
<ImageButton
style="@style/buttonStyle"
android:tag="2"
android:contentDescription="@string/contentDescription"
android:src="@drawable/button_selector_2"/>
<ImageButton
style="@style/buttonStyle"
android:tag="3"
android:contentDescription="@string/contentDescription"
android:src="@drawable/button_selector_3"/>
<LinearLayout
style="@style/layoutStyle"
android:layout_marginTop="8dip">
<ImageButton
style="@style/buttonStyle"
android:tag="4"
android:contentDescription="@string/contentDescription"
android:src="@drawable/button_selector_5"/>
<ImageButton
style="@style/buttonStyle"
android:tag="5"
android:contentDescription="@string/contentDescription"
android:src="@drawable/button_selector_4"/>
<ImageButton
style="@style/buttonStyle"
android:tag="6"
android:contentDescription="@string/contentDescription"
android:src="@drawable/button_selector_6"/>
…… and so on(total 6 child layout)
</LinearLayout>
Upvotes: 1
Views: 376
Reputation: 63
By Which code you assigned the image for the Buttons?
Are you assigning dynamically or static images?
If you are using static images means, store the images in the Drawable folder and clean-up the project. then assign the image for each button as follow...
<Button
android:id="@+id/button1"
android:layout_width="wrapcontent"
android:layout_height="wrapcontent"
android:background="@drawable/img1"
android:text="Button" />
Upvotes: 1