本文整理汇总了Java中android.view.View.inflate方法的典型用法代码示例。如果您正苦于以下问题:Java View.inflate方法的具体用法?Java View.inflate怎么用?Java View.inflate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.View
的用法示例。
在下文中一共展示了View.inflate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: AddressPicker
import android.view.View; //导入方法依赖的package包/类
public AddressPicker(Context context) {
super(context, R.style.transparentWindowStyle);
this.context = context;
view=View.inflate(context,R.layout.layout_address_picker,null);
initCityData();
initView();
initData();
setListener();
this.setContentView(view);
this.setCanceledOnTouchOutside(true);
//从底部弹出
Window window = this.getWindow();
window.setGravity(Gravity.BOTTOM); //此处可以设置dialog显示的位置
window.setWindowAnimations(R.style.windowAnimationStyle); //添加动画
WindowManager.LayoutParams params = window.getAttributes();
params.width = WindowManager.LayoutParams.MATCH_PARENT;
params.height = WindowManager.LayoutParams.WRAP_CONTENT;
window.setAttributes(params);
}
示例2: setAdapter
import android.view.View; //导入方法依赖的package包/类
/**
* 设置adapter
*/
private void setAdapter(GankIoDataBean mCustomBean) {
if (mHeaderView == null) {
mHeaderView = View.inflate(getContext(), R.layout.header_item_gank_custom, null);
bindingView.xrvCustom.addHeaderView(mHeaderView);
}
initHeader(mHeaderView);
boolean isAll = SPUtils.getString("gank_cala", "全部").equals("全部");
mAndroidAdapter.clear();
mAndroidAdapter.setAllType(isAll);
mAndroidAdapter.addAll(mCustomBean.getResults());
bindingView.xrvCustom.setLayoutManager(new LinearLayoutManager(getActivity()));
bindingView.xrvCustom.setAdapter(mAndroidAdapter);
mAndroidAdapter.notifyDataSetChanged();
mIsFirst = false;
}
示例3: addTextView
import android.view.View; //导入方法依赖的package包/类
private void addTextView(Context context, int viewTag) {
TextView tv = (TextView) View.inflate(context, R.layout.custom_textview, null);
LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
layoutParams.weight = 1.0F;
tv.setLayoutParams(layoutParams);
tv.setOnClickListener(this);
tv.setGravity(Gravity.CENTER);
if (mTextSize > 0f)
tv.setTextSize(0, mTextSize);
tv.setOnClickListener(this);
tv.setTag(viewTag);
if (viewTag == TAG_LEFT_VIEW) {
tv.setText(mLeftText);
mLeftTextView = tv;
} else if (viewTag == TAG_NONE_VIEW) {
tv.setText(mSimpleText);
mSimpleTextView = tv;
} else if (viewTag == TAG_RIGHT_VIEW) {
tv.setText(mRightText);
mRightTextView = tv;
}
addView(tv);
}
示例4: initRootView
import android.view.View; //导入方法依赖的package包/类
@Override
protected View initRootView(LayoutInflater inflater) {
if (view == null) {
view = View.inflate(getActivity(), R.layout.scroll, null);
}
ButterKnife.bind(this, view);
ViewGroup myparent = (ViewGroup) view.getParent();
//获取args传递的参数
if (getArguments() != null) {
orderid = getArguments().getString("orderId");
}
if (myparent != null) {
myparent.removeView(view);
}
return view;
}
示例5: buildLoading
import android.view.View; //导入方法依赖的package包/类
protected BuildBean buildLoading(BuildBean bean) {
Dialog dialog = new Dialog(bean.mContext);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
bean.dialog = dialog;
View root;
if (bean.isVertical) {
root = View.inflate(bean.mContext, R.layout.dialogui_loading_vertical, null);
} else {
root = View.inflate(bean.mContext, R.layout.dialogui_loading_horizontal, null);
}
View llBg = (View) root.findViewById(R.id.dialogui_ll_bg);
ProgressBar pbBg = (ProgressBar) root.findViewById(R.id.pb_bg);
TextView tvMsg = (TextView) root.findViewById(R.id.dialogui_tv_msg);
tvMsg.setText(bean.msg);
if (bean.isWhiteBg) {
llBg.setBackgroundResource(R.drawable.dialogui_shape_wihte_round_corner);
pbBg.setIndeterminateDrawable(bean.mContext.getResources().getDrawable(R.drawable.dialogui_rotate_mum));
tvMsg.setTextColor(bean.mContext.getResources().getColor(R.color.text_black));
} else {
llBg.setBackgroundResource(R.drawable.dialogui_shape_gray_round_corner);
pbBg.setIndeterminateDrawable(bean.mContext.getResources().getDrawable(R.drawable.dialogui_rotate_mum_light));
tvMsg.setTextColor(Color.WHITE);
}
bean.dialog.setContentView(root);
return bean;
}
示例6: getView
import android.view.View; //导入方法依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHoder viewHoder;
if(convertView ==null){
convertView = View.inflate(context, R.layout.net_video_item,null);
viewHoder = new ViewHoder();
viewHoder.iv_icon = (ImageView) convertView.findViewById(R.id.net_video_img);
viewHoder.tv_name = (TextView) convertView.findViewById(R.id.net_video_name);
viewHoder.tv_desc = (TextView) convertView.findViewById(R.id.net_video_desc);
convertView.setTag(viewHoder);
}else{
viewHoder = (ViewHoder) convertView.getTag();
}
SearchBean.ItemData mediaItem = mediaItems.get(position);
viewHoder.tv_name.setText(mediaItem.getItemTitle());
viewHoder.tv_desc.setText(mediaItem.getKeywords());
Glide.with(context).load(mediaItem.getItemImage().getImgUrl1())
.diskCacheStrategy(DiskCacheStrategy.ALL)
.placeholder(R.drawable.video_default)
.error(R.drawable.video_default)
.into(viewHoder.iv_icon);
return convertView;
}
示例7: initView
import android.view.View; //导入方法依赖的package包/类
protected void initView() {
gridView = (GridView) findViewById(R.id.gridview);
photo_delete = (ImageView) findViewById(R.id.photo_delete);
photo_choose = (ImageView) findViewById(R.id.photo_choose);
gridView.setSelector(new ColorDrawable(Color.TRANSPARENT));
if (type == VIDEOTYPE) {
adapter = new ImageGridAdapter(ImageGridActivity.this, null, videoList,
mHandler, type);
} else {
adapter = new ImageGridAdapter(ImageGridActivity.this, dataList, null,
mHandler, type);
}
dialog = new Dialog(this);
dialog.setCancelable(false);
dialog.setCanceledOnTouchOutside(false);
dialog.setTitle("数据上传");
View view = View.inflate(this, R.layout.customerdialogcheckroll, null);
bar = (ProgressBar) view.findViewById(R.id.customerdialog_pb);
tip = (TextView) view.findViewById(R.id.customerdialog_tv);
dialog.setContentView(view);
gridView.setAdapter(adapter);
}
示例8: buildChoosePassengersDialog
import android.view.View; //导入方法依赖的package包/类
private void buildChoosePassengersDialog() {
List<Passenger> passengers = PassengerUtil.getPassengers();
final List<String> list = new ArrayList<>();
for (Passenger p : passengers) {
list.add(p.getPassenger_name());
}
View view = View.inflate(MainActivity.this, R.layout.choose_passengers, null);
ListView listView = (ListView) view.findViewById(R.id.list_view);
PassengersAdapter adapter = new PassengersAdapter(MainActivity.this, list);
listView.setAdapter(adapter);
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
builder.setTitle("选择乘车人");
builder.setView(view);
AlertDialogUtil.setButton(builder, adapter, choosePassengers);
builder.show();
}
示例9: initRootView
import android.view.View; //导入方法依赖的package包/类
@Override
protected View initRootView(LayoutInflater inflater) {
if (view == null) {
view = View.inflate(getActivity(), R.layout.fragment_order_tranfer, null);
}
unbinder = ButterKnife.bind(this, view);
ViewGroup myparent = (ViewGroup) view.getParent();
if (getArguments() != null) {
argsModel = (ShowTransferStoreReqModel) getArguments().getSerializable("args");
transferCallback = (ResultCallback<TransfersTempModel>) getArguments().getSerializable("transferCallback");
}
if (myparent != null) {
myparent.removeView(view);
}
return view;
}
示例10: getView
import android.view.View; //导入方法依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View view = null;
ViewHolder viewHolder = null;
if(convertView!=null) {
view = convertView;
viewHolder = (ViewHolder) view.getTag();
}else {
viewHolder = new ViewHolder();
view = View.inflate(mContext, R.layout.search_result_item, null);
viewHolder.contentText = (TextView) view.findViewById(R.id.tv_content);
view.setTag(viewHolder);
}
String content = mResults.get(position).getName();
viewHolder.contentText.setText(content);
return view;
}
示例11: ViewHolder
import android.view.View; //导入方法依赖的package包/类
ViewHolder(Context context) {
int layoutResId;
if (colorShape == ColorShape.SQUARE) {
layoutResId = R.layout.cpv_color_item_square;
} else {
layoutResId = R.layout.cpv_color_item_circle;
}
view = View.inflate(context, layoutResId, null);
colorPanelView = (ColorPanelView) view.findViewById(R.id.cpv_color_panel_view);
imageView = (ImageView) view.findViewById(R.id.cpv_color_image_view);
originalBorderColor = colorPanelView.getBorderColor();
view.setTag(this);
}
示例12: notifyDataSetChanged
import android.view.View; //导入方法依赖的package包/类
/** 更新数据 */
public void notifyDataSetChanged() {
mTabsContainer.removeAllViews();
this.mTabCount = mTitles == null ? mViewPager.getAdapter().getCount() : mTitles.size();
View tabView;
for (int i = 0; i < mTabCount; i++) {
tabView = View.inflate(mContext, R.layout.layout_tab, null);
CharSequence pageTitle = mTitles == null ? mViewPager.getAdapter().getPageTitle(i) : mTitles.get(i);
addTab(i, pageTitle.toString(), tabView);
}
updateTabStyles();
}
示例13: createShort
import android.view.View; //导入方法依赖的package包/类
public Toast createShort() {
View contentView = View.inflate(context, R.layout.dialog_toast, null);
TextView tvMsg = (TextView) contentView.findViewById(R.id.tv_toast_msg);
toast = new Toast(context);
toast.setView(contentView);
toast.setGravity(Gravity.CENTER, 0, 0);
toast.setDuration(Toast.LENGTH_SHORT);
tvMsg.setText(msg);
return toast;
}
示例14: showWarnToast
import android.view.View; //导入方法依赖的package包/类
/**
* 显示警告的Toast
*
* @param text String
*/
public static void showWarnToast(Context context, String text) {
View view = View.inflate(context, R.layout.toast_view_prompt, null);
TextView tv = (TextView) view.findViewById(R.id.tv_toast_prompt);
tv.setText(text);
tv.setCompoundDrawablesWithIntrinsicBounds(R.drawable.toast_show_warn, 0, 0, 0);
Toast toast = getToast(context, view);
toast.show();
}
示例15: getRefreshHeaderView
import android.view.View; //导入方法依赖的package包/类
@Override
public View getRefreshHeaderView() {
if (mRefreshHeaderView == null) {
mRefreshHeaderView = View.inflate(mContext, R.layout.view_refresh_header_meituan, null);
mRefreshHeaderView.setBackgroundColor(Color.TRANSPARENT);
if (mRefreshViewBackgroundColorRes != -1) {
mRefreshHeaderView.setBackgroundResource(mRefreshViewBackgroundColorRes);
}
if (mRefreshViewBackgroundDrawableRes != -1) {
mRefreshHeaderView.setBackgroundResource(mRefreshViewBackgroundDrawableRes);
}
mMeiTuanRefreshView = (BGAMeiTuanRefreshView) mRefreshHeaderView.findViewById(R.id.meiTuanView);
if (mPullDownImageResId != -1) {
mMeiTuanRefreshView.setPullDownImageResource(mPullDownImageResId);
} else {
throw new RuntimeException("请调用" + BGAMeiTuanRefreshViewHolder.class.getSimpleName() + "的setPullDownImageResource方法设置下拉过程中的图片资源");
}
if (mChangeToReleaseRefreshAnimResId != -1) {
mMeiTuanRefreshView.setChangeToReleaseRefreshAnimResId(mChangeToReleaseRefreshAnimResId);
} else {
throw new RuntimeException("请调用" + BGAMeiTuanRefreshViewHolder.class.getSimpleName() + "的setChangeToReleaseRefreshAnimResId方法设置进入释放刷新状态时的动画资源");
}
if (mRefreshingAnimResId != -1) {
mMeiTuanRefreshView.setRefreshingAnimResId(mRefreshingAnimResId);
} else {
throw new RuntimeException("请调用" + BGAMeiTuanRefreshViewHolder.class.getSimpleName() + "的setRefreshingAnimResId方法设置正在刷新时的动画资源");
}
}
return mRefreshHeaderView;
}