Android Studio ScrollView blurred content -
i using android studio 1.2.2 , have problem scrollview can not solve. issue is, if add button scrollview, then, when scroll panel, button leaves blurred trace behind. (like in old windows, when pc froze, moving window on screen result in leaving trace on desktop, desktop not redrawn)
the grey square buttons added, , @ bottom can see there more buttons under it, as, in reality, there not, not redrawn background
this problem happens when doing followind both editing xml or constructing gui programatically
- adding 1 or more buttons directly scrollview
- adding tablelayout scrollview, adding tablerow, add button
- adding tablelayout scrollview, adding tablerow, add frame layout , button
please, if of knows might issue, point me in right direction? below provide code
the code in gameactivity.java
public class gameactivity extends activity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); //hide status bar view decorview = getwindow().getdecorview(); int uioptions = view.system_ui_flag_fullscreen; decorview.setsystemuivisibility(uioptions); actionbar actionbar = getactionbar(); actionbar.hide(); setcontentview(r.layout.activity_game); //add components mimageview = (imageview) findviewbyid(r.id.id_healthimageview); mimageview.setimageresource(r.drawable.test); //init table layout content creategui_filltable((tablelayout) findviewbyid(r.id.id_table_layout), 6, 3, 210); } private void creategui_filltable(tablelayout tl, int rows, int cols, int size_of_button) { if(rows <= 0 || cols <= 0) return; for(int z = 0; z < rows; z++) { tablerow tr = new tablerow(this); tr.setlayoutparams(new tablerow.layoutparams(tablerow.layoutparams.fill_parent, tablerow.layoutparams.wrap_content)); (int = 0; < cols; i++) tr.addview(create_button_fortable(size_of_button)); tl.addview(tr, new tablelayout.layoutparams(tablelayout.layoutparams.fill_parent, tablelayout.layoutparams.wrap_content)); } } private button create_button_fortable(int size_of_button) { //frame layout first /*framelayout fl = new framelayout(this); fl.setlayoutparams(new linearlayout.layoutparams( linearlayout.layoutparams.wrap_content, linearlayout.layoutparams.wrap_content));*/ //button button b = new button(this); b.settext(""); b.setlayoutparams(new tablerow.layoutparams(size_of_button, size_of_button)); //fl.addview(b); return b; }
here, main method focus on following call
creategui_filltable((tablelayout) findviewbyid(r.id.id_table_layout), 6, 3, 210);
now activity_game.xml contains code (complete cut , paste)
<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" android:paddingbottom="@dimen/activity_vertical_margin" tools:context="janglaser.survival.gameactivity"> <imageview android:layout_width="50dp" android:layout_height="50dp" android:id="@+id/id_healthimageview" android:layout_alignparentbottom="true" android:layout_marginbottom="48dp" /> <scrollview android:layout_width="300dp" android:layout_height="400dp" android:id="@+id/scrollview" android:layout_alignparentright="true" android:layout_alignparentend="true" android:layout_alignparenttop="true" android:layout_margintop="50dp" android:layout_marginleft="50dp"> <tablelayout android:id="@+id/id_table_layout" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_alignbottom="@+id/id_healthimageview" android:layout_centerhorizontal="true" android:orientation="horizontal"> </tablelayout> </scrollview>
thank kind response or advice, , time if red here.
i solved problem. issue parent container , table layout container did not have background color specified, not redrawing.
Comments
Post a Comment