android gridview
/** * * @param context * @param WidthdpValue * @param HeightdpValue * @param mList * @param mgridview * @param ImgType */ public static void setGvdip2px(final Context context, float WidthdpValue, float HeightdpValue, final List<String> mList, GridView mGridView, final int ImgType) { int itemWidth = CommonUtil.dip2px(context, WidthdpValue); int itemHeight = CommonUtil.dip2px(context, HeightdpValue); int itemSize = mList.size(); Linearlayout.layoutparams params = new LinearLayout.LayoutParams(itemSize * itemWidth, itemHeight); mGridView.setNumColumns(itemSize); mGridView.setLayoutParams(params); mGridView.setAdapter(new CheckCarImageAdapter(context, mList,ImgType)); mGridView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { intent intent = new Intent(context, CircuitryImageActivity.class); intent.putStringArrayListExtra("LIST", (ArrayList<String>) mList); intent.putExtra("TYPE", "1"); context.startActivity(intent); } }); }
<?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"> <!----> <LinearLayout android:id="@+id/ll_spray_paint" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:paddingLeft="20dp" android:paddingRight="20dp" android:paddingTop="10dp" android:paddingBottom="10dp" > <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center_vertical" android:orientation="horizontal"> <TextView android:id="@+id/tv_name" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="" /> <TextView android:layout_weight="1" android:layout_width="0dp" android:layout_height="1dp" /> <TextView android:id="@+id/tv_option" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="" /> </LinearLayout> <!--gridView--> <horizontalscrollview android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="5dp"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <CustomeGridView android:id="@+id/gv_Image" android:layout_width="match_parent" android:layout_height="wrap_content" android:horizontalSpacing="10dp" android:gravity="center" /> </LinearLayout> </HorizontalScrollView> </LinearLayout> <View android:layout_width="match_parent" android:layout_height="1dip" android:background="@drawable/pider"/> </LinearLayout>
public class CustomeGridView extends GridView { public CustomeGridView(Context context) { super(context); } public CustomeGridView(Context context, AttributeSet attrs) { super(context, attrs); } public CustomeGridView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } /** * 设置上下不滚动 */ @Override public boolean dispatchTouchEvent(motionevent ev) { //true:禁止滚动 return ev.getAction() == MotionEvent.ACTION_MOVE || super.dispatchTouchEvent(ev); } @Override protected void onmeasure(int widthmeasurespec, int heightMeasureSpec) { int expandSpec = heightMeasureSpec; boolean hasScrollBar = true; if (hasScrollBar) { expandSpec = MeasureSpec.makeMeasureSpec(integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST); super.onMeasure(widthMeasureSpec, expandSpec);// 直接测量出GridView的高度 } else { super.onMeasure(widthMeasureSpec, heightMeasureSpec); } } }
相关阅读
转自:https://blog.csdn.net/lirui0822/article/details/384234231、android:scaleType="center"(1)当图片大于ImageView的宽高:以
Android逆向之旅---Hook神器家族的Frida工具使用详解
一、前言 在逆向过程中有一个Hook神器是必不可少的工具,之前已经介绍了Xposed和Substrate了,不了解的同学可以看这两篇文章:Android
Java基础 Java Object类方法 HashMap原理,Hash冲突,并发集合,线程安全集合及实现原理 HashMap 和 HashTable 区别 Ha
原文地址:https://www.jb51.net/article/130296.htm 效果图: 作为程序员,首先会评估下工作量吧。在产品眼里,就是把图片合成一起嘛
转载请注明出处:http://blog.csdn.net/ym4189/article/details/77099881 前言 之前需要做一个弹簧效果的动画,网上一看,大家都用