當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。