//配置文件<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:tools="http://schemas.android.com/tools"    android:layout_width="wrap_content"    android:layout_height="wrap_content">     <android.support.v4.view.ViewPager" />     <LinearLayout        android:id="@+id/ll"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:layout_alignParentBottom="true"        android:layout_centerHorizontal="true"        android:layout_marginBottom="24.0dip"        android:orientation="horizontal"          android:visibility="gone"  >             </LinearLayout></RelativeLayout>

在界面引导的是需要用到ViewPager,一般页面引导也就是初次的时候展示,第二次我们不想要它出现,怎么办呢,

方法有二:1:简单设置隐藏setVisibility(View.GONE)

2:修改布局参数LayoutParams,布局参数官方文档描述是最详细的,我自己弄啦一下开始错啦。

原来这个参数是相对于Parent的,比如,上面这个配置文件中我们要修改LinearLayout的高度和宽度,那么我们应该设置

LinearLayout的布局参数由包裹他得父类布局给予,这就等于说,作为父类空间,我要给你子类在我的空间显示多大,而不是你要多大就多大。所以这个LayoutParams的类型就是RelativeLayout.LayoutParams。

LinearLayout ll=(LinearLayout) findViewById(R.id.ll);

//RelativeLayout.LayoutParams params=new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);

//ll.setLayoutParams(params);

ll.setVisibility(View.VISIBLE);

更多相关文章

  1. mybatisplus的坑 insert标签insert into select无参数问题的解决
  2. Python技巧匿名函数、回调函数和高阶函数
  3. python list.sort()根据多个关键字排序的方法实现
  4. android Dialog大小修改
  5. android中文api(89)——ViewManager
  6. Android调用天气预报的WebService简单例子
  7. Android(安卓)Activity的启动
  8. 从 Android(安卓)Sample ApiDemos 中学习 android.animation API
  9. android源码下载方式

随机推荐

  1. Android下的配置管理之道之repo的使用
  2. android连接打印机打印
  3. Android上的MSN初见成效~~!!
  4. Android (安卓数据的五种存储方式)
  5. Android向Fragment传值
  6. Android 如何开发指纹支付
  7. Android(安卓)LayoutInflater原理分析,带
  8. Android(安卓)Day03-SQLite数据库操作及L
  9. UI更新及消息处理机制
  10. 亲测可用Android原生代码添加系统服务