0
点赞
收藏
分享

微信扫一扫

Android HorizontalScrollView 水平滑动 在listview上面动态添加图片

追风骚年 2022-03-16 阅读 57

public void onClick(View v) {

Uri uri = Uri.parse(href);

Intent intent = new Intent(Intent.ACTION_VIEW,

uri);

startActivity(intent);

}

});

}

header_ll.addView(coupon_home_ad_item);

}

lv.addHeaderView(headerView);// 通过listview的addHeaderView方法 将header添加到

// listview里面

// listview的测试数据

for (int i = 0; i < 20; i++) {

arrayList.add(i + " ------------- "

  • System.currentTimeMillis());

}

ArrayAdapter adapter = new ArrayAdapter(this, R.layout.item,

R.id.textView1, arrayList);

lv.setAdapter(adapter);

}

}

xml代码:

activity_main.xml

<RelativeLayout xmlns:android=“http://schemas.android.com/apk/res/android”

xmlns:tools=“http://schemas.android.com/tools”

android:layout_width=“match_parent”

android:layout_height=“match_parent”

android:background="#f4f4f4"

android:paddingBottom="@dimen/activity_vertical_margin"

android:paddingLeft="@dimen/activity_horizontal_margin"

android:paddingRight="@dimen/activity_horizontal_margin"

android:paddingTop="@dimen/activity_vertical_margin"

tools:context=“com.baozi.bzhorizontalscrollview.MainActivity” >

<ListView

android:id="@+id/lv"

android:layout_width=“fill_parent”

android:layout_height=“fill_parent” >

item_home_header.xml

<?xml version="1.0" encoding="UTF-8"?>

<HorizontalScrollView xmlns:android=“http://schemas.android.com/apk/res/android”

xmlns:ptr=“http://schemas.android.com/apk/res-auto”

android:id="@+id/coupon_home_ad_hv"

android:layout_width=“fill_parent”

android:layout_height=“fill_parent”

android:orientation=“vertical”

android:scrollbars=“none” >

<LinearLayout

android:id="@+id/header_ll"

android:layout_width=“wrap_content”

android:layout_height=“wrap_content”

android:layout_marginBottom=“15dp”

android:background="#dddddd"

android:orientation=“horizontal” >

home_item.xml

<?xml version="1.0" encoding="UTF-8"?>

<FrameLayout xmlns:android=“http://schemas.android.com/apk/res/android”

xmlns:ptr=“http://schemas.android.com/apk/res-auto”

android:id="@+id/coupon_home_ad_ll"

android:layout_width=“wrap_content”

android:layout_height=“wrap_content”

android:layout_marginBottom=“10dp”

android:layout_marginLeft=“5dp”

android:layout_marginRight=“5dp”

android:layout_marginTop=“10dp”

android:gravity=“center”

android:orientation=“horizontal” >

<ImageView

android:id="@+id/coupon_ad_iv"

android:layout_width=“120dp”

android:layout_height=“90dp”

android:layout_margin=“4dp”

android:background="@drawable/ic_launcher"

android:scaleType=“centerCrop” />

<TextView

android:layout_width=“wrap_content”

android:layout_height=“wrap_content”

android:layout_gravity=“center”

android:text=“点我”

android:textColor="#000000"

android:textSize=“20sp” />

<View

android:layout_width=“1dp”

android:layout_height=“90dp”

android:background="#000000" />

步骤:

首先加载 header

headerView = LayoutInflater.from(this).inflate(R.layout.item_home_header,null);

header_ll = (LinearLayout)headerView.findViewById(R.id.header_ll);

最后

我见过很多技术leader在面试的时候,遇到处于迷茫期的大龄程序员,比面试官年龄都大。这些人有一些共同特征:可能工作了7、8年,还是每天重复给业务部门写代码,工作内容的重复性比较高,没有什么技术含量的工作。问到这些人的职业规划时,他们也没有太多想法。

其实30岁到40岁是一个人职业发展的黄金阶段,一定要在业务范围内的扩张,技术广度和深度提升上有自己的计划,才有助于在职业发展上有持续的发展路径,而不至于停滞不前。

不断奔跑,你就知道学习的意义所在!

以上进阶BATJ大厂学习资料可以免费分享给大家,需要完整版的朋友,【点这里可以看到全部内容】。

举报

相关推荐

0 条评论