多条目布局

@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		View view=null;
		Bean bean=list.get(position);
		Log.d("bean", bean.toString());
		int size = bean.getUrl_list().size();
		
		Log.i("size", size+"/");
		
        
		if(bean.isHas_image()==false){
			view=View.inflate(context,R.layout.fragment1_layout_adapter,null);
            TextView title= (TextView) view.findViewById(R.id.tv_title_1);
            title.setText(bean.getTitle());
		}
		if(bean.isHas_image()==true){
			
            view=View.inflate(context,R.layout.fragment1_layout_adapter,null);
            TextView textView= (TextView) view.findViewById(R.id.tv_title_1);
            ImageView imageview = (ImageView) view.findViewById(R.id.iv_image_1);
            textView.setText(bean.getTitle());
            imageloader.displayImage(bean.getMiddle_image(), imageview);
		}
		if(size>0){
			view=View.inflate(context,R.layout.fragment2_layout_adapter,null);
            TextView title2= (TextView) view.findViewById(R.id.tv_title_2);
            ImageView image1= (ImageView) view.findViewById(R.id.iv_image1_2);
            ImageView image2= (ImageView) view.findViewById(R.id.iv_image2_2);
            ImageView image3= (ImageView) view.findViewById(R.id.iv_image3_2);
            title2.setText(bean.getTitle());
            imageloader.displayImage(bean.getUrl_list().get(0),image1);
            imageloader.displayImage(bean.getUrl_list().get(1),image2);
            imageloader.displayImage(bean.getUrl_list().get(2),image3);
		}
		
		return view;
	}


//布局1

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center">

    <TextView
        android:layout_width="match_parent"
        android:layout_weight="1"
        android:layout_marginRight="10dp"
        android:layout_height="wrap_content"
        android:layout_marginLeft="10dp"
        android:gravity="center_horizontal"
        android:textSize="10dp"
        android:id="@+id/tv_title_1"/>
    <ImageView
        android:layout_width="85dp"
        android:layout_marginRight="17dp"
        android:layout_height="100dp"
        android:id="@+id/iv_image_1"/>
</LinearLayout>

//布局

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/tv_title_2"
        android:textSize="10dp"
        android:layout_marginRight="10dp"
        android:layout_margin="10dp"/>
    <LinearLayout
        android:layout_width="match_parent"
        android:orientation="horizontal"
        android:layout_marginRight="5dp"
        android:layout_marginLeft="5dp"
        android:layout_height="wrap_content">
        <ImageView
            android:layout_width="wrap_content"
            android:layout_weight="1"
            android:layout_height="wrap_content"
            android:layout_marginBottom="3dp"
            android:id="@+id/iv_image1_2"/>
        <ImageView
            android:layout_width="wrap_content"
            android:layout_weight="1"
            android:layout_marginRight="5dp"
            android:layout_marginLeft="5dp"
            android:layout_height="wrap_content"
            android:layout_marginBottom="3dp"
            android:id="@+id/iv_image2_2"/>
        <ImageView
            android:layout_width="wrap_content"
            android:layout_weight="1"
            android:layout_height="wrap_content"
            android:layout_marginBottom="3dp"
            android:id="@+id/iv_image3_2"/>
    </LinearLayout>
</LinearLayout>




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值