I'm using an android panel widget in my application to create a sliding panel effect from the top of my app (similar to the notification panel). When clicked the pan开发者_StackOverflow中文版el opens to fill about 30% of the screen. By default the panel is closed and has a handle to "show". I'm trying to modify it to be in the shown state by default but am unsure how to do it. I assume that I'll have to modify the Panel.java file but I suppose it might also be done in my layout file.. Any tips?
Assuming you're defining your own class which extends Panel...in your onCreate() override, you could try calling setOpen(true, false);
?
EDIT As you're not extending it yourself, you could simply call the setOpen() method as soon as your activity is created instead. Example...
public class MyActivity extends Activity {
protected Panel topPanel = null;
@Override
public void onCreate(Bundle savedInstance) {
super.onCreate();
setContentView(R.layout.main);
topPanel = (Panel) findViewById(R.id.top_panel);
topPanel.setOpen(true, false);
}
}
精彩评论