In my XML file I have:
<ListView android:id="android:id/list" android:layout_height="fill_parent"
android:layout_width="fill_parent" android:visibility="visible"
android:scrollbarAlwaysDrawVerticalTrack="true" android:fadingEdge="none">
</ListView>
My Java code:
public OnClickListener teamlisten = new OnClickListener() {
public void onClick(View v) {
// do something when the button is clicked
View list = (View)findViewById(R.id.myviewId);
list.setVisibility(View.INVISIBLE);
}
};
As you can see I'm trying to set my listview to invisible, the problem is I ca开发者_StackOverflown't get it to appear in my R.java so I can't seem to make it invisible. I only want the listview to turn invisible when a button is pressed.
Any help on this one would be appreciated.
Use getListView().setVisibility(View.INVISIBLE);
within your ListActivity
.
This is how it looks inside your code:
public OnClickListener teamlisten = new OnClickListener() {
public void onClick(View v) {
getListView().setVisibility(View.INVISIBLE);
}
};
精彩评论