当前位置: 首页>>代码示例>>Java>>正文


Java RelativeLayout.findViewById方法代码示例

本文整理汇总了Java中android.widget.RelativeLayout.findViewById方法的典型用法代码示例。如果您正苦于以下问题:Java RelativeLayout.findViewById方法的具体用法?Java RelativeLayout.findViewById怎么用?Java RelativeLayout.findViewById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.RelativeLayout的用法示例。


在下文中一共展示了RelativeLayout.findViewById方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addImageViewAtIndex

import android.widget.RelativeLayout; //导入方法依赖的package包/类
/**
 * 在特定位置添加ImageView
 */
public void addImageViewAtIndex(final int index, String imagePath) {
    if(imagePath==null || imagePath.length()==0){
        return;
    }
    Bitmap bmp = BitmapFactory.decodeFile(imagePath);
    final RelativeLayout imageLayout = createImageLayout();
    HyperImageView imageView = (HyperImageView) imageLayout.findViewById(R.id.edit_imageView);
    //Picasso.with(getContext()).load(imagePath).centerCrop().into(imageView);
    Glide.with(getContext()).load(imagePath).crossFade().centerCrop().into(imageView);
    //imageView.setImageBitmap(bmp);    //
    //imageView.setBitmap(bmp);         //这句去掉,保留下面的图片地址即可,优化图片占用
    imageView.setAbsolutePath(imagePath);
    // 调整imageView的高度
    int imageHeight = 500;
    if (bmp != null) {
        imageHeight = allLayout.getWidth() * bmp.getHeight() / bmp.getWidth();
        // 使用之后,还是回收掉吧
        bmp.recycle();
    }
    RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, imageHeight);
    lp.bottomMargin = 10;
    imageView.setLayoutParams(lp);
    allLayout.addView(imageLayout, index);
}
 
开发者ID:yangchong211,项目名称:YCCustomText,代码行数:28,代码来源:HyperTextView.java

示例2: setContentView

import android.widget.RelativeLayout; //导入方法依赖的package包/类
@Override
public void setContentView(@LayoutRes int layoutResID) {
    super.setContentView(layoutResID);
    baseLayout = (RelativeLayout) LayoutInflater.from(this).inflate(R.layout.activity_base, null);
    setContentView(baseLayout);
    toolbar = (Toolbar) findViewById(R.id.toolbar);
    tvToolbarTitle = (TextView) findViewById(R.id.tvToolbarTitle);
    tvActionButton = (TextView) findViewById(R.id.tvActionButton);
    tvActionDescription = (TextView) findViewById(R.id.tvActionDescription);
    tvAbout = (TextView) findViewById(R.id.tvAbout);
    rlUserAction = (RelativeLayout) findViewById(R.id.rlUserAction);
    rlContainer = (RelativeLayout) findViewById(R.id.rlContainer);
    ivToolbarImage = (ImageView) findViewById(R.id.ivToolbarImage);
    setSupportActionBar(toolbar);
    ViewStub stub = (ViewStub) baseLayout.findViewById(R.id.container);
    stub.setLayoutResource(layoutResID);
    stub.inflate();
    ButterKnife.bind(this);
}
 
开发者ID:mayuroks,项目名称:Coin-Tracker,代码行数:20,代码来源:BaseActivity.java

示例3: setTrailContent

import android.widget.RelativeLayout; //导入方法依赖的package包/类
private void setTrailContent() {
    List<TrailItem> trails = postsItem.getTrail();
    if (trails != null && trails.size() > 0) {
        trailLayout.removeAllViews();
        createTrailView(trails.size());
        for (int i = 0; i < trails.size(); i++) {
            RelativeLayout layout = trailViewCache.get(i);
            SimpleDraweeView avatar = (SimpleDraweeView) layout.findViewById(R.id.trail_avatar);
            TextView name = (TextView) layout.findViewById(R.id.trail_name);
            TextView content = (TextView) layout.findViewById(R.id.trail_content);
            FrescoUtils.setTumblrAvatarUri(avatar, trails.get(i).getBlog().getName(), 128);
            name.setText(trails.get(i).getBlog().getName());
            content.setText(fromHtlmCompat(trails.get(i).getContent_raw()));
            layout.setTag(trails.get(i).getBlog().getName());
            trailLayout.addView(layout);
        }
        trailLayout.setVisibility(View.VISIBLE);
    } else {
        trailLayout.setVisibility(View.GONE);
    }
}
 
开发者ID:mingdroid,项目名称:tumbviewer,代码行数:22,代码来源:PhotoPostVH.java

示例4: onCreateView

import android.widget.RelativeLayout; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    RelativeLayout rootView = (RelativeLayout) inflater.inflate(R.layout.fragment_scan, container, false);

    final EssensbonActivity activityReference = (EssensbonActivity) getActivity();
    final Button scan = rootView.findViewById(R.id.scan_button);

    final Handler handler = new Handler();
    final Runnable r = new Runnable() {
        @Override
        public void run() {
            scan.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    activityReference.scan();
                }
            });
        }
    };
    handler.postDelayed(r, 100);

    if (EssensbonUtils.mensaModeEnabled())
        handler.removeCallbacks(r);

    return rootView;
}
 
开发者ID:LCA311,项目名称:leoapp-sources,代码行数:27,代码来源:ScanFragment.java

示例5: getView

import android.widget.RelativeLayout; //导入方法依赖的package包/类
@Override
public View getView(final int position, final View convertView, ViewGroup parentView) {
    final RelativeLayout songListLayout = (RelativeLayout) songListInflater.inflate(R.layout.list_item_song_fixed, parentView, false);
    if (position % 2 - 1 == 0) {
        songListLayout.setBackgroundResource(R.color.gray_2);
    } else {
        songListLayout.setBackgroundResource(R.color.gray_3);
    }

    // Get the parts of a song layout
    //ImageView songItemIcon = (ImageView) songListLayout.findViewById(R.id.song_icon);
    TextView songItemName = (TextView) songListLayout.findViewById(R.id.song_name);
    TextView songItemArtist = (TextView) songListLayout.findViewById(R.id.song_composer);

    // Set the parts equal to the corresponding song
    SongData songItem = songDataList.get(position);
    //songItemIcon.setImageDrawable(songItem.getSongCover());
    songItemName.setText(songItem.getSongName());
    songItemArtist.setText(songItem.getSongArtist());

    // Set position as tag
    songListLayout.setTag(position);
    return songListLayout;
}
 
开发者ID:Davarco,项目名称:Divertio,代码行数:25,代码来源:SongFixedAdapter.java

示例6: createImageLayout

import android.widget.RelativeLayout; //导入方法依赖的package包/类
/**
 * 生成图片View
 */
private RelativeLayout createImageLayout() {
    RelativeLayout layout = (RelativeLayout) inflater.inflate(R.layout.edit_image_view, null);
    layout.setTag(viewTagIndex++);
    View closeView = layout.findViewById(R.id.image_close);
    //closeView.setVisibility(GONE);
    closeView.setTag(layout.getTag());
    closeView.setOnClickListener(btnListener);
    return layout;
}
 
开发者ID:yangchong211,项目名称:YCCustomText,代码行数:13,代码来源:HyperTextEditor.java

示例7: changeItemTextAtPosition

import android.widget.RelativeLayout; //导入方法依赖的package包/类
/**
 * Change item text if space navigation already set up
 *
 * @param itemIndex Target position
 * @param newText   Text to change
 */
public void changeItemTextAtPosition(int itemIndex, String newText) {
    if (itemIndex < 0 || itemIndex > spaceItems.size()) {
        throwArrayIndexOutOfBoundsException(itemIndex);
    } else {
        SpaceItem spaceItem = spaceItems.get(itemIndex);
        RelativeLayout textAndIconContainer = (RelativeLayout) spaceItemList.get(itemIndex);
        TextView spaceItemIcon = (TextView) textAndIconContainer.findViewById(R.id.space_text);
        spaceItemIcon.setText(newText);
        spaceItem.setItemName(newText);
        changedItemAndIconHashMap.put(itemIndex, spaceItem);
    }
}
 
开发者ID:sinhaDroid,项目名称:BlogBookApp,代码行数:19,代码来源:SpaceNavigationView.java

示例8: addItemGroupHeader

import android.widget.RelativeLayout; //导入方法依赖的package包/类
public ItemBuilder addItemGroupHeader(String header) {
    view = inflater.inflate(R.layout.item_element_header, parent, false);
    RelativeLayout rl = (RelativeLayout) view.findViewById(R.id.rl_container);
    TextView       tv = (TextView) rl.findViewById(R.id.tv_header);
    tv.setText(header);
    return this;
}
 
开发者ID:albertogiunta,项目名称:justintrain-client-android,代码行数:8,代码来源:ItemBuilder.java

示例9: forceShowBadge

import android.widget.RelativeLayout; //导入方法依赖的package包/类
/**
 * Force show badge without animation
 *
 * @param view      target budge
 * @param badgeItem BadgeItem object
 */
static void forceShowBadge(RelativeLayout view, BadgeItem badgeItem, boolean shouldShowBadgeWithNinePlus) {
    Utils.changeViewVisibilityVisible(view);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        view.setBackground(makeShapeDrawable(badgeItem.getBadgeColor()));
    } else {
        view.setBackgroundDrawable(makeShapeDrawable(badgeItem.getBadgeColor()));
    }
    TextView badgeTextView = (TextView) view.findViewById(R.id.badge_text_view);
    if (shouldShowBadgeWithNinePlus)
        badgeTextView.setText(badgeItem.getBadgeText());
    else
        badgeTextView.setText(badgeItem.getFullBadgeText());
}
 
开发者ID:sinhaDroid,项目名称:BlogBookApp,代码行数:20,代码来源:BadgeHelper.java

示例10: setUp

import android.widget.RelativeLayout; //导入方法依赖的package包/类
private void setUp(Context context)
{
	mRootView = (RelativeLayout) LayoutInflater.from(context).inflate(R.layout.wrapper_empty_view, this);
	mEmptyView = (RelativeLayout) mRootView.findViewById(R.id.empty_container);
	mGifView = (ImageView) mRootView.findViewById(R.id.empty_gif);
	mGifShadowView = (ImageView) mRootView.findViewById(R.id.empty_gif_panel);
	mIndicatorView = (ImageView) mRootView.findViewById(R.id.empty_indicator);
	mMessageView = (TextView) mRootView.findViewById(R.id.message);
	
	// addView(mRootView, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
	
	mEmptyView.setVisibility(View.GONE);
}
 
开发者ID:benniaobuguai,项目名称:android-project-gallery,代码行数:14,代码来源:EmptyView.java

示例11: createImageLayout

import android.widget.RelativeLayout; //导入方法依赖的package包/类
/**
 * 生成图片View
 */
private RelativeLayout createImageLayout() {
    RelativeLayout layout = (RelativeLayout) inflater.inflate(R.layout.edit_image_view, null);
    layout.setTag(viewTagIndex++);
    View closeView = layout.findViewById(R.id.image_close);
    closeView.setVisibility(GONE);
    return layout;
}
 
开发者ID:yangchong211,项目名称:YCCustomText,代码行数:11,代码来源:HyperTextView.java

示例12: initView

import android.widget.RelativeLayout; //导入方法依赖的package包/类
private void initView() {
    showBigBang = SPHelper.getBoolean(ConstantUtil.TOTAL_SWITCH, true);
    isStick=SPHelper.getBoolean(ConstantUtil.FLOATVIEW_IS_STICK,false);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
        Point point = new Point();
        mWindowManager.getDefaultDisplay().getSize(point);
        mScreenWidth = point.x;
        mScreenHeight = point.y;
    } else {
        mScreenWidth = mWindowManager.getDefaultDisplay().getWidth();
        mScreenHeight = mWindowManager.getDefaultDisplay().getHeight();
    }
    if (showBigBang) {
        mCurrentIconAlpha =  SPHelper.getInt(ConstantUtil.FLOATVIEW_ALPHA, 70) / 100f;
    } else {
        mCurrentIconAlpha = 0.6f * SPHelper.getInt(ConstantUtil.FLOATVIEW_ALPHA, 70) / 100f;
    }

    iconFloatView = (LinearLayout) View.inflate(mContext, R.layout.arc_float_icon, null);
    floatImageView = ((ImageView) iconFloatView.findViewById(R.id.float_image));
    acrFloatView = (RelativeLayout) View.inflate(mContext, R.layout.arc_view_float, null);
    archMenu = (ArcMenu) acrFloatView.findViewById(R.id.arc_menu);
    initIcon();
    archMenu.setOnModeSeletedListener(new ArcMenu.OnModeSeletedListener() {
        @Override
        public void onModeSelected() {
            showFloatImageView();
        }

        @Override
        public void onNothing() {

        }
    });
    // event listeners
    acrFloatView.setOnTouchListener(this);
    iconFloatView.setOnTouchListener(this);
}
 
开发者ID:l465659833,项目名称:Bigbang,代码行数:40,代码来源:ArcTipViewController.java

示例13: setUp

import android.widget.RelativeLayout; //导入方法依赖的package包/类
private void setUp(Context context)
{
	mRootView = (RelativeLayout) LayoutInflater.from(context).inflate(R.layout.wrapper_empty_view, this);
	mEmptyView = (RelativeLayout) mRootView.findViewById(R.id.container);
	mProgressBar = (ProgressBar) mRootView.findViewById(R.id.progressBar);
	mBackground = (ImageView) mRootView.findViewById(R.id.background);
	mMessage = (TextView) mRootView.findViewById(R.id.message);

	mEmptyView.setVisibility(View.GONE);
}
 
开发者ID:benniaobuguai,项目名称:android-project-gallery,代码行数:11,代码来源:EmptyViewProgressBar.java

示例14: createImageViewAtIndex

import android.widget.RelativeLayout; //导入方法依赖的package包/类
private void createImageViewAtIndex(Bitmap bmp, int index,String imageUrl) {
    RelativeLayout view= (RelativeLayout) inflater.inflate(R.layout.item_image,null);
    EditorImageView imageView= (EditorImageView) view.findViewById(R.id.editorImageView);
    imageView.setImageBitmap(bmp);
    imageView.setAbsoluteUrl(imageUrl);

    int imageHeight = getWidth() * bmp.getHeight() / bmp.getWidth();
    RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(
            LayoutParams.MATCH_PARENT, imageHeight);
    imageView.setLayoutParams(lp);
    view.setOnClickListener(onClickListener);
    allLayout.addView(view, index);
}
 
开发者ID:appteam-nith,项目名称:Nimbus,代码行数:14,代码来源:EditorView.java

示例15: initViews

import android.widget.RelativeLayout; //导入方法依赖的package包/类
private void initViews() {
    setClickable(true);
    setBackgroundColor(getResources().getColor(R.color.rc_recognizerview_bg_normal));
    RelativeLayout recognizerContainer = (RelativeLayout) LayoutInflater.from(getContext()).inflate(R.layout.rc_view_recognizer, null);
    View rlMic = recognizerContainer.findViewById(R.id.rl_mic);
    rlMic.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View view) {
            if (mIat == null || !mIat.isListening()) {
                startRecognize();
            } else {
                reset();
            }
        }
    });
    imgMic = (ImageView) recognizerContainer.findViewById(R.id.img_mic);

    TextView tvClear = (TextView) recognizerContainer.findViewById(R.id.btn_clear);
    tvClear.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            if (null != resultCallBack) {
                resultCallBack.onClearClick();
            }
        }
    });
    rlBottom = (RelativeLayout) recognizerContainer.findViewById(R.id.rl_bottom);
    addView(recognizerContainer);
    random = new Random();
}
 
开发者ID:hushengjun,项目名称:FastAndroid,代码行数:31,代码来源:Recognizer.java


注:本文中的android.widget.RelativeLayout.findViewById方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。