wg547308195
大师已去
2015-05-11 01:59

和listview同一layout的按钮被复制

  • android

这是显示的代码
public void Infoshow()
{
setContentView(R.layout.companyinfo);

    //Button m_back =(Button)findViewById(R.id.button1);

  // GridView gv=(GridView)findViewById(R.id.se1);
    ListView gv=(ListView)findViewById(R.id.listView1);

    //List<HashMap<String, String>> list = new ArrayList<HashMap<String, String>>();

   // list=new DB().CompanyInfo(myOrderCode);
    //list=new DB().CompanyInfo(searchwhere);

    SimpleAdapter adapter = new SimpleAdapter(
         MainActivity.this, 
            //this,
            list, 
            R.layout.companyinfo, 
            new String[] { "OrderCode", "ProductName_CN", "ProductName_JP" ,"OrderNum"}, 
            new int[] { R.id.txt_OrderCode, R.id.txt_ProductName_CN, R.id.txt_ProductName_JP , R.id.txt_OrderNum});

    gv.setAdapter(adapter);

这是页面布局
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ffffcc"

<FrameLayout
android:layout_width="fill_parent"
android:layout_height="40dip"
<TextView
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_marginBottom="0dip"
    android:layout_marginLeft="0dip"
    android:layout_marginTop="0dip"
    android:gravity="center"
    android:text="详细信息"
    android:textSize="20dip"
    android:textStyle="bold" >

</TextView> 
<LinearLayout
    android:orientation="horizontal"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"     
    android:gravity="center_vertical|right"     
>

    <Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="返回" />

</LinearLayout>


<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_marginLeft="7dip"
android:layout_marginRight="7dip"
android:layout_marginTop="4dip"
android:layout_marginBottom="4dip"

>      

           <TextView
            android:id="@+id/txt_OrderCode"
            android:layout_width="80dp"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:height="40dp"
            android:text="合同"
            android:textSize="14sp" />

        <TextView
            android:id="@+id/txt_ProductName_CN"
            android:layout_width="80dp"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:height="40dp"
            android:text="名称"
            android:textSize="14sp" />

        <TextView
            android:id="@+id/txt_ProductName_JP"
            android:layout_width="80dp"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:height="40dp"
            android:text="公司"
            android:textSize="14sp" />

        <TextView
            android:id="@+id/txt_OrderNum"
            android:layout_width="80dp"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:height="40dp"
            android:text="数量"
            android:textSize="14sp" />
</LinearLayout>

android:id="@+id/listView1"
android:layout_width="match_parent"
android:layout_height="wrap_content" >

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

3条回答

为你推荐