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


Java AppCompatTextView.setText方法代码示例

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


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

示例1: createDialog

import android.support.v7.widget.AppCompatTextView; //导入方法依赖的package包/类
private static AlertDialog createDialog(final Context context) {
    AppCompatTextView messageTextView = new AppCompatTextView(context);
    messageTextView.setTextSize(16f);
    messageTextView.setText(context.getString(R.string.download_manager_disabled));
    messageTextView.setPadding(50, 50, 50, 0);
    messageTextView.setTextColor(ContextCompat.getColor(context, R.color.black));
    return new AlertDialog.Builder(context)
            .setView(messageTextView)
            .setPositiveButton("ok", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    enableDownloadManager(context);
                }
            })
            .setCancelable(false)
            .create();
}
 
开发者ID:sfilmak,项目名称:MakiLite,代码行数:18,代码来源:DownloadManagerResolver.java

示例2: showInfo

import android.support.v7.widget.AppCompatTextView; //导入方法依赖的package包/类
protected void showInfo(String header, String desc, @Nullable Drawable drawable, boolean error) {
    hideKeyboard();
    AppCompatTextView infoHeader = (AppCompatTextView) llBottomSheet.findViewById(R.id.info_header);
    AppCompatTextView infoDesc = (AppCompatTextView) llBottomSheet.findViewById(R.id.info_desc);
    AppCompatImageView infoImg = (AppCompatImageView) llBottomSheet.findViewById(R.id.info_img);
    if (error) {
        llBottomSheet.findViewById(R.id.info_img).setVisibility(View.GONE);
        ((AppCompatButton) findViewById(R.id.ok_dimiss)).setText("Close");
    } else {
        llBottomSheet.findViewById(R.id.info_img).setVisibility(View.VISIBLE);
        ((AppCompatButton) findViewById(R.id.ok_dimiss)).setText("Ok");
    }

    infoHeader.setText(header);
    infoDesc.setText(desc);
    if (drawable != null)
        infoImg.setImageDrawable(drawable);
    bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
}
 
开发者ID:aksalj,项目名称:africastalking-android,代码行数:20,代码来源:BaseActivity.java

示例3: getView

import android.support.v7.widget.AppCompatTextView; //导入方法依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    StatisticsActivity.Achievement achievement = getItem(position);
    if (convertView == null) {
        convertView = LayoutInflater.from(getContext())
                        .inflate(R.layout.achievement_list_template, parent, false);
    }

    AppCompatTextView title = (AppCompatTextView)convertView.findViewById(R.id.achievement_list_item_title);
    AppCompatTextView description = (AppCompatTextView)convertView.findViewById(R.id.achievement_list_item_description);
    AppCompatImageView layer1 = (AppCompatImageView)convertView.findViewById(R.id.medal_layer1);
    AppCompatImageView layer2 = (AppCompatImageView)convertView.findViewById(R.id.medal_layer2);
    AppCompatImageView layer3 = (AppCompatImageView)convertView.findViewById(R.id.medal_layer3);

    if(achievement != null) {
        if(achievement.title != null) title.setText(achievement.title);
        if(achievement.description != null) description.setText(achievement.description);
        layer1.setColorFilter(achievement.getBandColor(), PorterDuff.Mode.SRC_IN);
        layer2.setColorFilter(achievement.getMedalBrightColor(), PorterDuff.Mode.SRC_IN);
        layer3.setColorFilter(achievement.getMedalDarkColor(), PorterDuff.Mode.SRC_IN);
    }

    return convertView;
}
 
开发者ID:AndroidNewbies,项目名称:Sanxing,代码行数:25,代码来源:AchievementsAdapter.java

示例4: setupViews

import android.support.v7.widget.AppCompatTextView; //导入方法依赖的package包/类
private void setupViews() {
    drawer = (DrawerLayout) findViewById(R.id.drawerlayout);
    navview = (NavigationView) findViewById(R.id.navview);
    ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, R.string.main_drawer_open, R.string.main_drawer_close);
    //drawer.addDrawerListener(this);
    toggle.syncState();
    navview.setNavigationItemSelectedListener(this);

    View _view = findViewById(R.id.bottom_search_results);
    resultsBottom = BottomSheetBehavior.from(_view);
    resultsBottom.setHideable(true);
    resultsBottom.setState(BottomSheetBehavior.STATE_HIDDEN);
    resultsRv = (RecyclerView) findViewById(R.id.rv_results);
    resultsRv.setLayoutManager(new LinearLayoutManager(MainActivity.this,
            LinearLayoutManager.VERTICAL, false));
    photoIv = (SquareImageView) findViewById(R.id.iv_photo);
    searchFab = (FloatingActionButton) findViewById(R.id.fab_search);
    closeBottomBtn = (AppCompatImageButton) findViewById(R.id.btn_close_bottom);
    indicatorLoadingLayout = (LinearLayout) findViewById(R.id.layout_main_loading);
    indicatorStatusTv = (AppCompatTextView) findViewById(R.id.tv_progress_status);
    AppCompatTextView versionAppTv = navview.getHeaderView(0).findViewById(R.id.tv_header_app_version);
    versionAppTv.setText(C.getAppVersion(MainActivity.this));
}
 
开发者ID:maddog05,项目名称:whatanime-android,代码行数:24,代码来源:MainActivity.java

示例5: convert

import android.support.v7.widget.AppCompatTextView; //导入方法依赖的package包/类
@Override
protected void convert(BaseViewHolder holder, final Collection item) {
    final CardView layout = holder.getView(R.id.item_layout);

    final AppCompatTextView title = holder.getView(R.id.title_txt);
    final AppCompatTextView count = holder.getView(R.id.count_txt);
    title.setText(String.valueOf(item.title));
    count.setText(count.getContext().getString(R.string.photos, String.valueOf(item.total_photos)));

    final AppCompatImageView image = holder.getView(R.id.item_image);
    Collection.CoverPhoto cp = item.cover_photo;
    mFullRequest.load(getRegularSizeUrl(cp.urls.regular))
            .thumbnail(mThumbRequest.load(cp.urls.thumb))
            .into(image);

    float finalHeight = displaymetrics.widthPixels / ((float) cp.width / (float) cp.height);
    image.setMinimumHeight((int) finalHeight);
    startSaturationAnimation(image.getContext(), image);
    layout.setCardBackgroundColor(computeCardBackgroundColor(cp.color));
}
 
开发者ID:alphater,项目名称:garras,代码行数:21,代码来源:CollectionAdapter.java

示例6: onBindView

import android.support.v7.widget.AppCompatTextView; //导入方法依赖的package包/类
@Override
public void onBindView(@Nullable Bundle savedInstanceState, View rootView) {
    final int size = ITEMS.size();
    for (int i = 0; i < size; i++) {
        LayoutInflater.from(getContext()).inflate(R.layout.bottom_item_icon_text_layout, mBottomBar);
        final RelativeLayout item = (RelativeLayout) mBottomBar.getChildAt(i);
        //设置每个item的点击事件
        item.setTag(i);
        item.setOnClickListener(this);
        final IconTextView itemIcon = (IconTextView) item.getChildAt(0);
        final AppCompatTextView itemTitle = (AppCompatTextView) item.getChildAt(1);
        final BottomTabBean bean = TAB_BEANS.get(i);
        //初始化数据
        itemIcon.setText(bean.getICON());
        itemTitle.setText(bean.getTITLE());
        if (i == mIndexDelegate) {
            itemIcon.setTextColor(mClickedColor);
            itemTitle.setTextColor(mClickedColor);
        }
    }
    final ISupportFragment[] delegateArray = ITEM_DELEGATES.toArray(new ISupportFragment[size]);
    getSupportDelegate().loadMultipleRootFragment(R.id.bottom_bar_delegate_container, mIndexDelegate, delegateArray);

}
 
开发者ID:remerber,项目名称:FastEc,代码行数:25,代码来源:BaseBottomDelegate.java

示例7: showInfo

import android.support.v7.widget.AppCompatTextView; //导入方法依赖的package包/类
private void showInfo(String header, String desc, @Nullable Drawable drawable, boolean error) {
    hideKeyboard();
    AppCompatTextView infoHeader = (AppCompatTextView) llBottomSheet.findViewById(R.id.info_header);
    AppCompatTextView infoDesc = (AppCompatTextView) llBottomSheet.findViewById(R.id.info_desc);
    AppCompatImageView infoImg = (AppCompatImageView) llBottomSheet.findViewById(R.id.info_img);
    if (error) {
        llBottomSheet.findViewById(R.id.info_img).setVisibility(View.GONE);
        ((AppCompatButton) findViewById(R.id.ok_dimiss)).setText("Close");
    } else {
        llBottomSheet.findViewById(R.id.info_img).setVisibility(View.VISIBLE);
        ((AppCompatButton) findViewById(R.id.ok_dimiss)).setText("Ok");
    }

    infoHeader.setText(header);
    infoDesc.setText(desc);
    if (drawable != null)
        infoImg.setImageDrawable(drawable);
    bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
}
 
开发者ID:KingsMentor,项目名称:Luhn,代码行数:20,代码来源:Luhn.java

示例8: onViewCreated

import android.support.v7.widget.AppCompatTextView; //导入方法依赖的package包/类
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    editGeohash = (AppCompatEditText) view.findViewById(R.id.edit_hash);
    editLat = (AppCompatEditText) view.findViewById(R.id.edit_lat);
    editLon = (AppCompatEditText) view.findViewById(R.id.edit_lon);
    textPrecision = (AppCompatTextView) view.findViewById(R.id.text_precision);
    seekPrecision = (AppCompatSeekBar) view.findViewById(R.id.seek_precision);

    editGeohash.addTextChangedListener(hashTextWatcher);
    editLat.addTextChangedListener(locationTextWatcher);
    editLon.addTextChangedListener(locationTextWatcher);
    seekPrecision.setOnSeekBarChangeListener(this);

    location = new Location("geohash_example");
    textPrecision.setText("Precision: " + 1);
}
 
开发者ID:drfonfon,项目名称:android-geohash,代码行数:18,代码来源:ConverterFragment.java

示例9: createDialog

import android.support.v7.widget.AppCompatTextView; //导入方法依赖的package包/类
private static AlertDialog createDialog(final Context context) {
    AppCompatTextView messageTextView = new AppCompatTextView(context);
    messageTextView.setTextSize(16f);
    messageTextView.setText(context.getString(R.string.download_manager_disabled));
    return new AlertDialog.Builder(context)
            .setView(messageTextView, 50, 30, 50, 30)
            .setPositiveButton("ok", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    enableDownloadManager(context);
                }
            })
            .setCancelable(false)
            .create();
}
 
开发者ID:sfilmak,项目名称:MakiLite,代码行数:16,代码来源:Sharer.java

示例10: showDialogWithHtmlTextView

import android.support.v7.widget.AppCompatTextView; //导入方法依赖的package包/类
public void showDialogWithHtmlTextView(@StringRes int resTitleId, String text, boolean isHtml, DialogInterface.OnDismissListener dismissedListener) {
    AppCompatTextView textView = new AppCompatTextView(_context);
    int padding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 16,
            _context.getResources().getDisplayMetrics());
    textView.setMovementMethod(new LinkMovementMethod());
    textView.setPadding(padding, 0, padding, 0);

    textView.setText(isHtml ? new SpannableString(Html.fromHtml(text)) : text);
    AlertDialog.Builder dialog = new AlertDialog.Builder(_context)
            .setPositiveButton(android.R.string.ok, null)
            .setOnDismissListener(dismissedListener)
            .setTitle(resTitleId)
            .setView(textView);
    dialog.show();
}
 
开发者ID:gsantner,项目名称:markor,代码行数:16,代码来源:ActivityUtils.java

示例11: convert

import android.support.v7.widget.AppCompatTextView; //导入方法依赖的package包/类
@Override
protected void convert(BaseViewHolder holder, final User item) {
    AppCompatTextView userName = holder.getView(R.id.user_name);
    userName.setText(item.name);
    AppCompatTextView userDes = holder.getView(R.id.user_des);
    userDes.setText(String.valueOf("@" + item.username));

    final AppCompatImageView image = holder.getView(R.id.user_avatar);
    mFullRequest.load(item.profile_image.large)
            .thumbnail(mThumbRequest.load(item.profile_image.small))
            .into(image);
}
 
开发者ID:alphater,项目名称:garras,代码行数:13,代码来源:UserAdapter.java

示例12: convert

import android.support.v7.widget.AppCompatTextView; //导入方法依赖的package包/类
@Override
protected void convert(MultipleViewHolder holder, MultipleItemEntity entity) {
    super.convert(holder, entity);
    switch (holder.getItemViewType()) {
        case OrderListItemType.ITEM_ORDER_LIST:
            final AppCompatImageView imageView = holder.getView(R.id.image_order_list);
            final AppCompatTextView title = holder.getView(R.id.tv_order_list_title);
            final AppCompatTextView price = holder.getView(R.id.tv_order_list_price);
            final AppCompatTextView time = holder.getView(R.id.tv_order_list_time);

            final String titleVal = entity.getField(MultipleFields.TITLE);
            final String timeVal = entity.getField(OrderItemFields.TIME);
            final double priceVal = entity.getField(OrderItemFields.PRICE);
            final String imageUrl = entity.getField(MultipleFields.IMAGE_URL);

            Glide.with(mContext)
                    .load(imageUrl)
                    .diskCacheStrategy(DiskCacheStrategy.ALL)
                    .centerCrop()
                    .dontAnimate()
                    .into(imageView);

            title.setText(titleVal);
            price.setText("价格:" + String.valueOf(priceVal));
            time.setText("时间:" + timeVal);
            break;
        default:

            break;
    }
}
 
开发者ID:remerber,项目名称:FastEc,代码行数:32,代码来源:OrderListAdapter.java

示例13: onCreateView

import android.support.v7.widget.AppCompatTextView; //导入方法依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.permission_rationale, container, false);
    AppCompatTextView rationaleView = (AppCompatTextView) rootView.findViewById(R.id.permission_text);
    rationaleView.setText(getArguments().getString(TEXT_KEY));
    rationaleView.setTextSize(TypedValue.COMPLEX_UNIT_PX, getArguments().getFloat(TEXT_SIZE));
    rationaleView.setTextColor(getArguments().getInt(TEXT_COLOR));
    rationaleView.setTypeface(Typeface.createFromAsset(getResources().getAssets(), "fonts/" + getArguments().getString(TEXT_FONT)));
    return rootView;
}
 
开发者ID:KingsMentor,项目名称:Rationale,代码行数:12,代码来源:PermissionRationale.java

示例14: convert

import android.support.v7.widget.AppCompatTextView; //导入方法依赖的package包/类
@Override
    protected void convert(final MultipleViewHolder holder, MultipleItemEntity entity) {
        super.convert(holder, entity);
        switch (holder.getItemViewType()) {
            case  AddressItemType.ITEM_ADDRESS:
                final String name = entity.getField(MultipleFields.NAME);
                final String phone = entity.getField(AddressItemFields.PHONE);
                final String address = entity.getField(AddressItemFields.ADDRESS);
                final boolean isDefault = entity.getField(MultipleFields.TAG);
                final int id = entity.getField(MultipleFields.ID);

                final AppCompatTextView nameText = holder.getView(R.id.tv_address_name);
                final AppCompatTextView phoneText = holder.getView(R.id.tv_address_phone);
                final AppCompatTextView addressText = holder.getView(R.id.tv_address_address);
                final AppCompatTextView deleteTextView = holder.getView(R.id.tv_address_delete);


                deleteTextView.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        //请求接口删除
//                        RestClient.builder()
//                                .url("address.php")
//                                .params("id", id)
//                                .success(new ISuccess() {
//                                    @Override
//                                    public void onSuccess(String response) {
                                        remove(holder.getLayoutPosition());
//                                    }
//                                })
//                                .build()
//                                .post();
                    }
                });

                nameText.setText(name);
                phoneText.setText(phone);
                addressText.setText(address);



                break;
            default:
        
                break;
        }

        
        
    }
 
开发者ID:remerber,项目名称:FastEc,代码行数:51,代码来源:AddressAdapter.java

示例15: updateGeohash

import android.support.v7.widget.AppCompatTextView; //导入方法依赖的package包/类
private void updateGeohash() {
    hashText.setText(geoHash.toString());
    map.clear();

    GeoHash[] aj = geoHash.getAdjacent();

    for (int i = 0; i < ajGrid.getChildCount(); i++) {
        AppCompatTextView text = (AppCompatTextView) ajGrid.getChildAt(i);
        switch (i) {
            case 0:
                text.setText(aj[7].toString());
                break;
            case 1:
                text.setText(aj[0].toString());
                break;
            case 2:
                text.setText(aj[1].toString());
                break;
            case 3:
                text.setText(aj[6].toString());
                break;
            case 4:
                text.setText(geoHash.toString());
                break;
            case 5:
                text.setText(aj[2].toString());
                break;
            case 6:
                text.setText(aj[5].toString());
                break;
            case 7:
                text.setText(aj[4].toString());
                break;
            case 8:
                text.setText(aj[3].toString());
                break;
        }
    }

    Location[] locations = new Location[]{
            geoHash.getBoundingBox().getUpperLeft(),
            geoHash.getBoundingBox().getUpperRight(),
            geoHash.getBoundingBox().getLowerRight(),
            geoHash.getBoundingBox().getLowerLeft()
    };
    locationCorrect(locations);

    map.addPolygon(new PolygonOptions()
            .add(locationToLatLng(locations[0]))
            .add(locationToLatLng(locations[1]))
            .add(locationToLatLng(locations[2]))
            .add(locationToLatLng(locations[3]))
            .fillColor(Color.argb(100, 125, 200, 200))
            .strokeColor(Color.BLUE)
    );
}
 
开发者ID:drfonfon,项目名称:android-geohash,代码行数:57,代码来源:MapFragment.java


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