Java Code Examples for com.zhy.autolayout.utils.AutoUtils#autoSize()
The following examples show how to use
com.zhy.autolayout.utils.AutoUtils#autoSize() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ListFragment.java From AutoLayout with Apache License 2.0 | 6 votes |
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder = null; if (convertView == null) { holder = new ViewHolder(); convertView = LayoutInflater.from(mContext).inflate(R.layout.list_item, parent, false); convertView.setTag(holder); //对于listview,注意添加这一行,即可在item上使用高度 AutoUtils.autoSize(convertView); } else { holder = (ViewHolder) convertView.getTag(); } return convertView; }
Example 2
Source File: ListFragment.java From AndroidAutoLayout with Apache License 2.0 | 6 votes |
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder = null; if (convertView == null) { holder = new ViewHolder(); convertView = LayoutInflater.from(mContext).inflate(R.layout.list_item, parent, false); convertView.setTag(holder); //对于listview,注意添加这一行,即可在item上使用高度 AutoUtils.autoSize(convertView); } else { holder = (ViewHolder) convertView.getTag(); } return convertView; }
Example 3
Source File: BaseDialog.java From Ticket-Analysis with MIT License | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { getWindow().requestFeature(Window.FEATURE_NO_TITLE); LayoutParams clp = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); LayoutInflater layoutInflater = LayoutInflater.from(getContext()); View content = getContentView(layoutInflater); initView(content); View layout = getBaseDialogView(layoutInflater); AutoUtils.autoSize(layout); //适配 layout.findViewById(R.id.dialog_top).setOnClickListener(this); layout.findViewById(R.id.dialog_bottom).setOnClickListener(this); LinearLayout contentLayout = (LinearLayout) layout.findViewById(R.id.dialog_content); contentLayout.addView(content, clp); setContentView(layout, clp); setCancelable(true); setCanceledOnTouchOutside(true); WindowManager.LayoutParams lParams = getWindow().getAttributes(); lParams.gravity = Gravity.CENTER; lParams.width = LayoutParams.MATCH_PARENT; lParams.height = LayoutParams.MATCH_PARENT; lParams.alpha = 1.0f; lParams.dimAmount = 0.0f; getWindow().setWindowAnimations(R.style.dialogWindowAnim); getWindow().setAttributes(lParams); }
Example 4
Source File: BaseHolder.java From MVPArms with Apache License 2.0 | 5 votes |
public BaseHolder(View itemView) { super(itemView); //点击事件 itemView.setOnClickListener(this); //屏幕适配 if (ThirdViewUtil.isUseAutolayout()) { AutoUtils.autoSize(itemView); } //绑定 ButterKnife ThirdViewUtil.bindTarget(this, itemView); }
Example 5
Source File: BaseAdapterHelper.java From AndroidBase with Apache License 2.0 | 5 votes |
protected BaseAdapterHelper(Context context, ViewGroup parent, int layoutId, int position) { this.context = context; this.position = position; this.layoutId = layoutId; this.views = new SparseArray<View>(); convertView = LayoutInflater.from(context) // .inflate(layoutId, parent, false); convertView.setTag(this); //对于listview,注意添加这一行,即可在item上使用高度 AutoUtils.autoSize(convertView); }
Example 6
Source File: RecyclerViewFragment.java From AndroidAutoLayout with Apache License 2.0 | 5 votes |
@Override public com.zhy.base.adapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { com.zhy.base.adapter.ViewHolder viewHolder = super.onCreateViewHolder(parent, viewType); AutoUtils.autoSize(viewHolder.getConvertView()); return viewHolder; }
Example 7
Source File: RecyclerViewGridFragment.java From AndroidAutoLayout with Apache License 2.0 | 5 votes |
public ViewHolder(View itemView) { super(itemView); Random random = new Random(); itemView.setBackgroundColor(Color.argb(200, random.nextInt(255), random.nextInt(255), random.nextInt(255))); //recyclerview,注意添加这一行 AutoUtils.autoSize(itemView, AutoAttr.BASE_HEIGHT); // Log.e("", itemView.getLayoutParams().width + " , " + itemView.getLayoutParams().height); }
Example 8
Source File: BaseHolder.java From Aurora with Apache License 2.0 | 4 votes |
public BaseHolder(View itemView) { super(itemView); itemView.setOnClickListener(this);//点击事件 if (ThirdViewUtil.USE_AUTOLAYOUT == 1) AutoUtils.autoSize(itemView);//适配 ThirdViewUtil.bindTarget(this, itemView);//绑定 }
Example 9
Source File: RecyclerViewFragment.java From AutoLayout with Apache License 2.0 | 4 votes |
public ViewHolder(View itemView) { super(itemView); //对于listview,注意添加这一行,即可在item上使用高度 AutoUtils.autoSize(itemView); }
Example 10
Source File: UIViewHolder.java From AndroidBase with Apache License 2.0 | 4 votes |
public UIViewHolder(Context context, ViewGroup parent, int layoutId) { mContext = context; mConvertView = LayoutInflater.from(context).inflate(layoutId, parent, false); ButterKnife.bind(this, mConvertView); AutoUtils.autoSize(mConvertView); }