本文整理汇总了Java中android.widget.TextView.setVisibility方法的典型用法代码示例。如果您正苦于以下问题:Java TextView.setVisibility方法的具体用法?Java TextView.setVisibility怎么用?Java TextView.setVisibility使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.TextView
的用法示例。
在下文中一共展示了TextView.setVisibility方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import android.widget.TextView; //导入方法依赖的package包/类
private void init(){
findViewById(R.id.btn_back).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
finish();
}
});
tv_msg = (TextView)findViewById(R.id.tv_msg);
tv_msg.setVisibility(View.GONE);
mGridLayoutManager = new GridLayoutManager(this, 2);//new LinearLayoutManager(getApplicationContext());
// mLinearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
rv = (RecyclerView) findViewById(R.id.rv);
rv.setHasFixedSize(true);
rv.setLayoutManager(mGridLayoutManager);
// rv.addItemDecoration(new DividerItemDecoration(getApplicationContext(), DividerItemDecoration.VERTICAL_LIST));
loading = (AVLoadingIndicatorView)findViewById(R.id.loading);
}
示例2: bindView
import android.widget.TextView; //导入方法依赖的package包/类
@Override
protected View bindView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
WheelItemLayout view = (WheelItemLayout) View.inflate(getApplicationContext(), R.layout.item_wheel, null);
view.setParentHeight(parent.getHeight());
convertView = view;
}
Log.d(TAG, "bindView position:"+position);
WheelData wheelData = mList.get(position);
ImageView imageView = (ImageView) convertView.findViewById(R.id.iv);
TextView tv = (TextView) convertView.findViewById(R.id.text);
if(position == mCurrentPositon){
imageView.setImageResource(wheelData.getId_s());
}else {
imageView.setImageResource(wheelData.getId());
}
tv.setVisibility(View.GONE);
// tv.setText(wheelData.getName());
return convertView;
}
示例3: onBindViewHolder
import android.widget.TextView; //导入方法依赖的package包/类
public void onBindViewHolder(ViewHolder holder, int position) {
boolean isFirstUnLock;
int i = 0;
if (position == this.mLockSize + this.mHeadSize) {
isFirstUnLock = true;
} else {
isFirstUnLock = false;
}
if (holder instanceof LockBlockViewHolder) {
LockBlockViewHolder.access$700((LockBlockViewHolder) holder).setText(((HomeBlock) this.mList.get(position - 1)).blockname);
} else if (holder instanceof UnLockBlockViewHolder) {
LogInfo.log("zhaoxiang", "isFirstUnLock" + isFirstUnLock + "-------" + position);
UnLockBlockViewHolder.access$500((UnLockBlockViewHolder) holder).setText(((HomeBlock) this.mList.get(position - this.mHeadSize)).blockname);
TextView access$300 = UnLockBlockViewHolder.access$300((UnLockBlockViewHolder) holder);
if (isFirstUnLock) {
i = 8;
}
access$300.setVisibility(i);
}
}
示例4: resetView
import android.widget.TextView; //导入方法依赖的package包/类
private void resetView() {
TextView tvScanResult = (TextView) findViewById(R.id.tvScanResult);
timeoutHandler.removeCallbacksAndMessages(null);
tvScanResult.setVisibility(View.VISIBLE);
((TextView) findViewById(R.id.tvScanResult)).setText("");
findViewById(R.id.rlScanStatus).setBackgroundColor(
ContextCompat.getColor(this, R.color.scan_result_unknown));
if (!config.getCamera()) {
qrView.setVisibility(View.GONE);
} else {
qrView.setVisibility(View.VISIBLE);
}
if (config.isConfigured()) {
tvScanResult.setText(R.string.hint_scan);
} else {
tvScanResult.setText(R.string.hint_config);
}
}
示例5: getView
import android.widget.TextView; //导入方法依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = ((Activity) getContext()).getLayoutInflater().inflate(R.layout.item_message, parent, false);
}
ImageView photoImageView = (ImageView) convertView.findViewById(R.id.photoImageView);
TextView messageTextView = (TextView) convertView.findViewById(R.id.messageTextView);
TextView authorTextView = (TextView) convertView.findViewById(R.id.nameTextView);
Message message = getItem(position);
boolean isPhoto = message.getPhotoUrl() != null;
if (isPhoto) {
messageTextView.setVisibility(View.GONE);
photoImageView.setVisibility(View.VISIBLE);
Glide.with(photoImageView.getContext())
.load(message.getPhotoUrl())
.into(photoImageView);
} else {
messageTextView.setVisibility(View.VISIBLE);
photoImageView.setVisibility(View.GONE);
messageTextView.setText(message.getText());
}
authorTextView.setText(message.getName());
return convertView;
}
示例6: initBottom
import android.widget.TextView; //导入方法依赖的package包/类
private void initBottom(LinearLayout llBottom, float ratio) {
LinearLayout llAt = new LinearLayout(activity);
llAt.setPadding(0, 0, 0, 5);
llAt.setBackgroundColor(0xffffffff);
int bottomHeight = (int) (DESIGN_BOTTOM_HEIGHT * ratio);
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, bottomHeight);
llBottom.addView(llAt, lp);
tvAt = new TextView(activity);
tvAt.setTextColor(0xff3b3b3b);
tvAt.setTextSize(TypedValue.COMPLEX_UNIT_SP, 21);
tvAt.setGravity(Gravity.BOTTOM);
tvAt.setText("@");
int padding = (int) (DESIGN_LEFT_PADDING * ratio);
tvAt.setPadding(padding, 0, padding, 0);
lp = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
llAt.addView(tvAt, lp);
tvAt.setOnClickListener(this);
if (isShowAtUserLayout(platform.getName())) {
tvAt.setVisibility(View.VISIBLE);
} else {
tvAt.setVisibility(View.INVISIBLE);
}
tvTextCouter = new TextView(activity);
tvTextCouter.setTextColor(0xff3b3b3b);
tvTextCouter.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
tvTextCouter.setGravity(Gravity.BOTTOM | Gravity.RIGHT);
onTextChanged(etContent.getText(), 0, 0, 0);
tvTextCouter.setPadding(padding, 0, padding, 0);
lp = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
lp.weight = 1;
llAt.addView(tvTextCouter, lp);
View v = new View(activity);
v.setBackgroundColor(0xffcccccc);
int px_1 = ratio > 1 ? ((int) ratio) : 1;
lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, px_1);
llBottom.addView(v, lp);
}
示例7: getView
import android.widget.TextView; //导入方法依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = ((Activity) getContext()).getLayoutInflater().inflate(R.layout.item_message, parent, false);
}
ImageView photoImageView = (ImageView) convertView.findViewById(R.id.photoImageView);
TextView messageTextView = (TextView) convertView.findViewById(R.id.messageTextView);
TextView authorTextView = (TextView) convertView.findViewById(R.id.nameTextView);
FriendlyMessage message = getItem(position);
boolean isPhoto = message.getPhotoUrl() != null;
if (isPhoto) {
messageTextView.setVisibility(View.GONE);
photoImageView.setVisibility(View.VISIBLE);
Glide.with(photoImageView.getContext())
.load(message.getPhotoUrl())
.into(photoImageView);
} else {
messageTextView.setVisibility(View.VISIBLE);
photoImageView.setVisibility(View.GONE);
messageTextView.setText(message.getText());
}
authorTextView.setText(message.getName());
return convertView;
}
示例8: a
import android.widget.TextView; //导入方法依赖的package包/类
public a a(String str) {
TextView textView = (TextView) this.b.findViewById(ResContainer.getResourceId(this.a,
ResType.ID, "umeng_socialize_first_area_title"));
if (TextUtils.isEmpty(str)) {
textView.setVisibility(8);
} else {
textView.setText(str);
}
return this;
}
示例9: ButtonView
import android.widget.TextView; //导入方法依赖的package包/类
public ButtonView(Context context, String title, String summary, OnClickListener onClickListener) {
super(context);
this.setOnClickListener(onClickListener);
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.view_button, null);
addView(view);
TextView titleView = (TextView) view.findViewById(R.id.title);
TextView summaryView = (TextView) view.findViewById(R.id.summary);
titleView.setText(title);
if (summary == null) {
summaryView.setVisibility(GONE);
} else {
summaryView.setText(summary);
}
View dividerTop = findViewById(R.id.divider_top);
View dividerBottom = findViewById(R.id.divider_bottom);
if (App.getAppPreferences().getTheme().equals("0")) {
dividerTop.setBackgroundColor(getResources().getColor(R.color.grey_one));
dividerBottom.setBackgroundColor(getResources().getColor(R.color.grey_one));
} else {
dividerTop.setBackgroundColor(getResources().getColor(R.color.grey_three));
dividerBottom.setBackgroundColor(getResources().getColor(R.color.grey_three));
}
}
示例10: builder
import android.widget.TextView; //导入方法依赖的package包/类
public CustomAlertPPtDialog builder() {
view = LayoutInflater.from(context).inflate(R.layout.view_alertdialog, null);
lLayout_bg = (LinearLayout) view.findViewById(R.id.layout_bg);
txt_title = (TextView) view.findViewById(R.id.txt_title);
txt_title.setVisibility(View.GONE);
txt_msg = (TextView) view.findViewById(R.id.txt_msg);
txt_msg.setVisibility(View.GONE);
et_input = (EditText) view.findViewById(R.id.et_input);
et_input.setVisibility(View.GONE);
btn_neg = (Button) view.findViewById(R.id.btn_neg);
btn_neg.setVisibility(View.GONE);
btn_pos = (Button) view.findViewById(R.id.btn_pos);
btn_pos.setVisibility(View.GONE);
btn_mid = (Button) view.findViewById(R.id.btn_mid);
btn_mid.setVisibility(View.GONE);
line1 = (ImageView) view.findViewById(R.id.line1);
line1.setVisibility(View.GONE);
line2 = (ImageView) view.findViewById(R.id.line2);
line2.setVisibility(View.GONE);
dialog = new Dialog(context, R.style.AlertDialogStyle);
dialog.setContentView(view);
lLayout_bg.setLayoutParams(new FrameLayout.LayoutParams((int) (
display.getWidth() * 0.85), LayoutParams.WRAP_CONTENT));
return this;
}
示例11: initUI
import android.widget.TextView; //导入方法依赖的package包/类
private void initUI() {
// init mVideoSurface
mVideoSurface = (TextureView)findViewById(R.id.video_previewer_surface);
recordingTime = (TextView) findViewById(R.id.timer);
mCaptureBtn = (Button) findViewById(R.id.btn_capture);
mRecordBtn = (ToggleButton) findViewById(R.id.btn_record);
mShootPhotoModeBtn = (Button) findViewById(R.id.btn_shoot_photo_mode);
mRecordVideoModeBtn = (Button) findViewById(R.id.btn_record_video_mode);
mWayPointBtn=(Button)findViewById(R.id.btn_wayPoint);
if (null != mVideoSurface) {
mVideoSurface.setSurfaceTextureListener(this);
}
mCaptureBtn.setOnClickListener(this);
mRecordBtn.setOnClickListener(this);
mShootPhotoModeBtn.setOnClickListener(this);
mRecordVideoModeBtn.setOnClickListener(this);
mWayPointBtn.setOnClickListener(this);
recordingTime.setVisibility(View.INVISIBLE);
mRecordBtn.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
startRecord();
} else {
stopRecord();
}
}
});
}
示例12: initView
import android.widget.TextView; //导入方法依赖的package包/类
private void initView(View view) {
mSearchEditText = (EditText) view.findViewById(R.id.search);
mListView = (ListView) view.findViewById(R.id.listview);
mNoFriends = (TextView) view.findViewById(R.id.show_no_friend);
mSidBar = (SideBar) view.findViewById(R.id.sidrbar);
mDialogTextView = (TextView) view.findViewById(R.id.group_dialog);
mSidBar.setTextView(mDialogTextView);
LayoutInflater mLayoutInflater = LayoutInflater.from(getActivity());
mHeadView = mLayoutInflater.inflate(R.layout.item_contact_list_header,
null);
mUnreadTextView = (TextView) mHeadView.findViewById(R.id.tv_unread);
RelativeLayout newFriendsLayout = (RelativeLayout) mHeadView.findViewById(R.id.re_newfriends);
RelativeLayout groupLayout = (RelativeLayout) mHeadView.findViewById(R.id.re_chatroom);
RelativeLayout publicServiceLayout = (RelativeLayout) mHeadView.findViewById(R.id.publicservice);
RelativeLayout selfLayout = (RelativeLayout) mHeadView.findViewById(R.id.contact_me_item);
mSelectableRoundedImageView = (SelectableRoundedImageView) mHeadView.findViewById(R.id.contact_me_img);
mNameTextView = (TextView) mHeadView.findViewById(R.id.contact_me_name);
updatePersonalUI();
mListView.addHeaderView(mHeadView);
mNoFriends.setVisibility(View.VISIBLE);
selfLayout.setOnClickListener(this);
groupLayout.setOnClickListener(this);
newFriendsLayout.setOnClickListener(this);
publicServiceLayout.setOnClickListener(this);
//设置右侧触摸监听
mSidBar.setOnTouchingLetterChangedListener(new SideBar.OnTouchingLetterChangedListener() {
@Override
public void onTouchingLetterChanged(String s) {
//该字母首次出现的位置
int position = mFriendListAdapter.getPositionForSection(s.charAt(0));
if (position != -1) {
mListView.setSelection(position);
}
}
});
}
示例13: showAlreadyAuthenticated
import android.widget.TextView; //导入方法依赖的package包/类
private void showAlreadyAuthenticated() {
TextView textView = (TextView) findViewById(
R.id.already_has_valid_device_credential_message);
textView.setVisibility(View.VISIBLE);
textView.setText(getString(
R.string.already_confirmed_device_credentials_within_last_x_seconds,
AUTHENTICATION_DURATION_SECONDS));
findViewById(R.id.purchase_button).setEnabled(false);
}
示例14: onItemSelected
import android.widget.TextView; //导入方法依赖的package包/类
@Override
public void onItemSelected(AdapterView<?> parent, View view,
int pos, long id)
{
// An item was selected. You can retrieve the selected item
// using parent.getItemAtPosition(pos)
// Check id
switch (parent.getId())
{
case R.id.spinner:
String item = (String)parent.getItemAtPosition(pos);
// Get length
length = Integer.parseInt(item);
// Remove the unused slots
if (letters != null)
{
for (int i = 0; i < letters.getChildCount(); i++)
{
TextView text = (TextView)letters.getChildAt(i);
if (i < length)
text.setVisibility(View.VISIBLE);
// Temporarily remove the text change listener to
// stop unexpected consequences
else
{
text.setVisibility(View.GONE);
text.removeTextChangedListener(this);
text.setText("");
text.addTextChangedListener(this);
}
}
}
}
}
示例15: onCreate
import android.widget.TextView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.alert_dialog);
setCanceledOnTouchOutside(true);
tvTitle = (TextView) findViewById(R.id.tvAlertDialogTitle);
tvMessage = (TextView) findViewById(R.id.tvAlertDialogMessage);
btnPositive = (Button) findViewById(R.id.btnAlertDialogPositive);
btnNegative = (Button) findViewById(R.id.btnAlertDialogNegative);
tvTitle.setVisibility(StringUtil.isNotEmpty(title, true) ? View.VISIBLE : View.GONE);
tvTitle.setText("" + StringUtil.getCurrentString());
if (StringUtil.isNotEmpty(strPositive, true)) {
btnPositive.setText(StringUtil.getCurrentString());
}
btnPositive.setOnClickListener(this);
if (showNegativeButton) {
if (StringUtil.isNotEmpty(strNegative, true)) {
btnNegative.setText(StringUtil.getCurrentString());
}
btnNegative.setOnClickListener(this);
} else {
btnNegative.setVisibility(View.GONE);
}
tvMessage.setText(StringUtil.getTrimedString(message));
}