当前位置: 动力学知识库 > 问答 > 编程问答 >

android - Adjust layout after using View.gone to delete empty black space

问题描述:

i have 3 views of a drawerlayout added using inflater class

public View getView(int position, View myView , ViewGroup parent) {

mView = inflater.inflate(R.layout.navigation_drawer_1,parent,false);

switch (position % 2) {

case 0:

myView = inflater.inflate(R.layout.navigation_menu1, parent,

false);

break;

case 1:

myView = inflater.inflate(R.layout.navigation_menu2, parent,

false);

break;}}

I want to show only the second layout in an if statement (if the user if log in) so I did this

 if (position == 1) {

if (myUser.IsLogin()){

myView.setVisibility(View.VISIBLE);

}else{

myView.setVisibility(View.GONE);

}

}

As you can see in the screenshot below that the first view (yellow stroke )is hidden ,using View.gone but there is black empty space !

http://i.stack.imgur.com/eETss.png

I want to adjust the drawer layout so that the black empty space gone once the view is gone!

Thanks

分享给朋友:
您可能感兴趣的文章:
随机阅读: