• 项目Contact开发中遇到的,引以为戒


    程序进去就闪退

    其中指示错误的地方,函数内容如下:

     1 public void loadButtomMenu() {
     2         gv_buttom_menu = (GridView) this.findViewById(R.id.gv_bottom_menu);
     3         gv_buttom_menu.setBackgroundResource(R.drawable.channelgallery_bg);
     4         gv_buttom_menu.setNumColumns(5);//设置列
     5         gv_buttom_menu.setGravity(Gravity.CENTER );//设置位置
     6         gv_buttom_menu.setVerticalSpacing(10);//设置垂直间隔
     7         gv_buttom_menu.setHorizontalSpacing(10);//设置水平间隔
     8         gv_buttom_menu.setAdapter(new GridViewAdapter(MainActivity.this));
     9         
    10     }

     R.JAVA文件中:

    public static final int gv_bottom_menu=0x7f060018;
    public static final int gv_buttom_menu=0x7f060016;

    为什么会产生两个这样的相似id,一看布局文件:

     1     <GridView 
     2         android:id="@+id/gv_buttom_menu"
     3         android:layout_width="fill_parent"
     4         android:layout_height = "65sp"
     5         android:layout_alignParentBottom="true"
     6         ></GridView>
     7     
     8     <LinearLayout 
     9         android:id="@+id/ll_search"
    10         android:layout_width = "fill_parent"
    11         android:layout_height = "wrap_content"
    12         android:layout_alignParentLeft="true"
    13         android:visibility="gone"
    14         android:layout_above="@+id/gv_bottom_menu"
    15         >

     原来是这个问题。。。。。。。。。。

    不要怀疑软件2啦,其实是自己2啦

  • 相关阅读:
    Super Mario
    SPOJ Count on a tree
    SPOJ DQUERY
    51nod 区间中第K大的数
    POJ2104 K-th Number
    矩阵模板
    Sasha and Array
    MVC RenderSection
    Lazy Acquisition
    .net4.5 await async 简化之后的异步编程模型
  • 原文地址:https://www.cnblogs.com/hixin/p/4139688.html
Copyright © 2020-2023  润新知