Java Code Examples for android.widget.TextView.setHint()

The following are Jave code examples for showing how to use setHint() of the android.widget.TextView class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: UbiBike-client   File: MsgSenderActivity.java   View Source Code Vote up 6 votes
private void guiUpdateInitState() {

        mTextInput = (TextView) findViewById(R.id.editText1);
        mTextInput.setHint("type remote virtual IP (192.168.0.0/16)");
        mTextInput.setEnabled(false);

        mTextOutput = (TextView) findViewById(R.id.editText2);
        mTextOutput.setEnabled(false);
        mTextOutput.setText("");

        findViewById(R.id.idConnectButton).setEnabled(false);
        findViewById(R.id.idDisconnectButton).setEnabled(false);
        findViewById(R.id.idSendButton).setEnabled(false);
        findViewById(R.id.idWifiOnButton).setEnabled(true);
        findViewById(R.id.idWifiOffButton).setEnabled(false);
        findViewById(R.id.idInRangeButton).setEnabled(false);
        findViewById(R.id.idInGroupButton).setEnabled(false);
    }
 
Example 2
Project: ElephantAsia   File: AddContactFragment.java   View Source Code Vote up 6 votes
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
  View view = inflater.inflate(R.layout.add_elephant_contact_fragment, container, false);
  View footerView = inflater.inflate(R.layout.add_button_footer_list, list, false);

  TextView addButton = findById(footerView, R.id.add_button_footer);
  addButton.setHint(getString(R.string.add_contact));
  addButton.setOnClickListener(new View.OnClickListener() {
    public void onClick(View v) {
      Intent intent = new Intent(getActivity(), SearchContactActivity.class);
      getActivity().startActivityForResult(intent, REQUEST_CONTACT_SELECTED);
    }
  });

  ButterKnife.bind(this, view);
  list.addFooterView(footerView);
  list.setAdapter(adapter);
  return (view);
}
 
Example 3
Project: GitHub   File: UiUtils.java   View Source Code Vote up 5 votes
/**
 * 设置hint大小
 *
 * @param size
 * @param v
 * @param res
 */
public static void setViewHintSize(int size, TextView v, int res) {
    SpannableString ss = new SpannableString(getResources().getString(
            res));
    // 新建一个属性对象,设置文字的大小
    AbsoluteSizeSpan ass = new AbsoluteSizeSpan(size, true);
    // 附加属性到文本  
    ss.setSpan(ass, 0, ss.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);

    // 设置hint  
    v.setHint(new SpannedString(ss)); // 一定要进行转换,否则属性会消失
}
 
Example 4
Project: NeiHanDuanZiTV   File: ArmsUtils.java   View Source Code Vote up 5 votes
/**
 * 设置hint大小
 *
 * @param size
 * @param v
 * @param res
 */
public static void setViewHintSize(Context context, int size, TextView v, int res) {
    SpannableString ss = new SpannableString(getResources(context).getString(
            res));
    // 新建一个属性对象,设置文字的大小
    AbsoluteSizeSpan ass = new AbsoluteSizeSpan(size, true);
    // 附加属性到文本  
    ss.setSpan(ass, 0, ss.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);

    // 设置hint  
    v.setHint(new SpannedString(ss)); // 一定要进行转换,否则属性会消失
}
 
Example 5
Project: AppCommonFrame   File: UiUtils.java   View Source Code Vote up 5 votes
/**
 * 设置hint大小
 *
 * @param size
 * @param v
 * @param res
 */
public static void setViewHintSize(int size, TextView v, int res) {
    SpannableString ss = new SpannableString(getResources().getString(
            res));
    // 新建一个属性对象,设置文字的大小
    AbsoluteSizeSpan ass = new AbsoluteSizeSpan(size, true);
    // 附加属性到文本  
    ss.setSpan(ass, 0, ss.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);

    // 设置hint  
    v.setHint(new SpannedString(ss)); // 一定要进行转换,否则属性会消失
}
 
Example 6
Project: MVPArms_Fragment-fragment   File: UiUtils.java   View Source Code Vote up 5 votes
/**
 * 设置hint大小
 *
 * @param size
 * @param v
 * @param res
 */
public static void setViewHintSize(Context context, int size, TextView v, int res) {
    SpannableString ss = new SpannableString(getResources(context).getString(
            res));
    // 新建一个属性对象,设置文字的大小
    AbsoluteSizeSpan ass = new AbsoluteSizeSpan(size, true);
    // 附加属性到文本  
    ss.setSpan(ass, 0, ss.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);

    // 设置hint  
    v.setHint(new SpannedString(ss)); // 一定要进行转换,否则属性会消失
}
 
Example 7
Project: MoligyMvpArms   File: ArmsUtils.java   View Source Code Vote up 5 votes
/**
 * 设置hint大小
 *
 * @param size
 * @param v
 * @param res
 */
public static void setViewHintSize(Context context, int size, TextView v, int res) {
    SpannableString ss = new SpannableString(getResources(context).getString(
            res));
    // 新建一个属性对象,设置文字的大小
    AbsoluteSizeSpan ass = new AbsoluteSizeSpan(size, true);
    // 附加属性到文本  
    ss.setSpan(ass, 0, ss.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);

    // 设置hint  
    v.setHint(new SpannedString(ss)); // 一定要进行转换,否则属性会消失
}
 
Example 8
Project: ElephantAsia   File: AddParentageFragment.java   View Source Code Vote up 5 votes
private void setupChildrenList(LayoutInflater inflater) {
  View headerView = inflater.inflate(R.layout.add_button_footer_list, childrenList, false);
  TextView addChildButton = findById(headerView, R.id.add_button_footer);
  addChildButton.setHint(getString(R.string.add_child));
  addChildButton.setOnClickListener(new View.OnClickListener() {
    public void onClick(View v) {
      Intent intent = new Intent(getActivity(), SearchElephantActivity.class);
      intent.setAction(SELECT_ELEPHANT);
      getActivity().startActivityForResult(intent, REQUEST_CHILD_SELECTED);
    }
  });
  childrenList.addHeaderView(headerView);
  childrenList.setAdapter(adapter);
}
 
Example 9
Project: MVVMArms   File: UiUtils.java   View Source Code Vote up 5 votes
/**
 * 设置hint大小
 *
 * @param size
 * @param v
 * @param res
 */
public static void setViewHintSize(Context context, int size, TextView v, int res) {
    SpannableString ss = new SpannableString(getResources(context).getString(
            res));
    // 新建一个属性对象,设置文字的大小
    AbsoluteSizeSpan ass = new AbsoluteSizeSpan(size, true);
    // 附加属性到文本
    ss.setSpan(ass, 0, ss.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);

    // 设置hint,一定要进行转换,否则属性会消失
    v.setHint(new SpannedString(ss));
}
 
Example 10
Project: ElephantAsia   File: EditParentageFragment.java   View Source Code Vote up 5 votes
private void setupChildrenList(LayoutInflater inflater) {
  View headerView = inflater.inflate(R.layout.add_button_footer_list, childrenList, false);
  TextView addChildButton = findById(headerView, R.id.add_button_footer);
  addChildButton.setHint(getString(R.string.add_child));
  addChildButton.setOnClickListener(new View.OnClickListener() {
    public void onClick(View v) {
      Intent intent = new Intent(getActivity(), SearchElephantActivity.class);
      intent.setAction(SELECT_ELEPHANT);
      getActivity().startActivityForResult(intent, REQUEST_CHILD_SELECTED);
    }
  });
  childrenList.addHeaderView(headerView);
  childrenList.setAdapter(adapter);
}
 
Example 11
Project: Aurora   File: UiUtils.java   View Source Code Vote up 5 votes
/**
 * 设置hint大小
 *
 * @param size
 * @param v
 * @param res
 */
public static void setViewHintSize(Context context, int size, TextView v, int res) {
    SpannableString ss = new SpannableString(getResources(context).getString(
            res));
    // 新建一个属性对象,设置文字的大小
    AbsoluteSizeSpan ass = new AbsoluteSizeSpan(size, true);
    // 附加属性到文本  
    ss.setSpan(ass, 0, ss.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);

    // 设置hint  
    v.setHint(new SpannedString(ss)); // 一定要进行转换,否则属性会消失
}
 
Example 12
Project: Aurora   File: ArmsUtils.java   View Source Code Vote up 5 votes
/**
 * 设置hint大小
 *
 * @param size
 * @param v
 * @param res
 */
public static void setViewHintSize(Context context, int size, TextView v, int res) {
    SpannableString ss = new SpannableString(getResources(context).getString(
            res));
    // 新建一个属性对象,设置文字的大小
    AbsoluteSizeSpan ass = new AbsoluteSizeSpan(size, true);
    // 附加属性到文本  
    ss.setSpan(ass, 0, ss.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);

    // 设置hint  
    v.setHint(new SpannedString(ss)); // 一定要进行转换,否则属性会消失
}
 
Example 13
Project: SimpleDialogFragments   File: SpinnerViewHolder.java   View Source Code Vote up 5 votes
@NonNull
@Override
public View getView(int position, View convertView, @NonNull ViewGroup parent) {
    View view = super.getView(position, convertView, parent);
    if (position == emptyIndex) {
        TextView label = (TextView) view.findViewById(android.R.id.text1);
        label.setText("");
        label.setHint(getItem(position));
    }
    return view;
}
 
Example 14
Project: GmArchMvvm   File: UiUtils.java   View Source Code Vote up 5 votes
/**
 * 设置hint大小
 *
 * @param size
 * @param v
 * @param res
 */
public static void setViewHintSize(Context context, int size, TextView v, int res) {
    SpannableString ss = new SpannableString(getResources(context).getString(
            res));
    // 新建一个属性对象,设置文字的大小
    AbsoluteSizeSpan ass = new AbsoluteSizeSpan(size, true);
    // 附加属性到文本
    ss.setSpan(ass, 0, ss.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);

    // 设置hint,一定要进行转换,否则属性会消失
    v.setHint(new SpannedString(ss));
}
 
Example 15
Project: MVPArmsTest1   File: UiUtils.java   View Source Code Vote up 5 votes
/**
 * 设置hint大小
 *
 * @param size
 * @param v
 * @param res
 */
public static void setViewHintSize(Context context, int size, TextView v, int res) {
    SpannableString ss = new SpannableString(getResources(context).getString(
            res));
    // 新建一个属性对象,设置文字的大小
    AbsoluteSizeSpan ass = new AbsoluteSizeSpan(size, true);
    // 附加属性到文本  
    ss.setSpan(ass, 0, ss.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);

    // 设置hint  
    v.setHint(new SpannedString(ss)); // 一定要进行转换,否则属性会消失
}
 
Example 16
Project: YCCustomText   File: HyperTextView.java   View Source Code Vote up 5 votes
/**
 * 生成文本输入框
 */
public TextView createTextView(String hint, int paddingTop) {
    TextView textView = (TextView) inflater.inflate(R.layout.hyper_text_view, null);
    textView.setTag(viewTagIndex++);
    textView.setPadding(0, paddingTop, 0, paddingTop);
    textView.setHint(hint);
    return textView;
}
 
Example 17
Project: mvparms   File: UiUtils.java   View Source Code Vote up 5 votes
/**
 * 设置hint大小
 *
 * @param size
 * @param v
 * @param res
 */
public static void setViewHintSize(int size, TextView v, int res) {
    SpannableString ss = new SpannableString(getResources().getString(
            res));
    // 新建一个属性对象,设置文字的大小
    AbsoluteSizeSpan ass = new AbsoluteSizeSpan(size, true);
    // 附加属性到文本  
    ss.setSpan(ass, 0, ss.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);

    // 设置hint  
    v.setHint(new SpannedString(ss)); // 一定要进行转换,否则属性会消失
}
 
Example 18
Project: Calculator-Infinity   File: MainActivity.java   View Source Code Vote up 4 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    
    view=(TextView)findViewById(R.id.view);
    
    clear=(Button)findViewById(R.id.clearAll);
    delete=(Button)findViewById(R.id.delete);
    one=(Button)findViewById(R.id.one);
    two=(Button)findViewById(R.id.two);
    three=(Button)findViewById(R.id.three);
    four=(Button)findViewById(R.id.four);
    five=(Button)findViewById(R.id.five);
    six=(Button)findViewById(R.id.six);
    seven=(Button)findViewById(R.id.seven);
    eight=(Button)findViewById(R.id.eight);
    nine=(Button)findViewById(R.id.nine);
    zero=(Button)findViewById(R.id.zero);
    plus=(Button)findViewById(R.id.plus);
    minus=(Button)findViewById(R.id.minus);
    multiply=(Button)findViewById(R.id.multiply);
    divide=(Button)findViewById(R.id.divide);
    equal=(Button)findViewById(R.id.equal);
    point=(Button)findViewById(R.id.point);
    
    clear.setOnClickListener(this);
    delete.setOnClickListener(this);
    one.setOnClickListener(this);
    two.setOnClickListener(this);
    three.setOnClickListener(this);
    four.setOnClickListener(this);
    five.setOnClickListener(this);
    six.setOnClickListener(this);
    seven.setOnClickListener(this);
    eight.setOnClickListener(this);
    nine.setOnClickListener(this);
    zero.setOnClickListener(this);
    plus.setOnClickListener(this);
    minus.setOnClickListener(this);
    multiply.setOnClickListener(this);
    divide.setOnClickListener(this);
    equal.setOnClickListener(this);
    point.setOnClickListener(this);
    
    view.setCursorVisible(true);
    view.setHint("0");

    /*Animation anim = new AlphaAnimation(0.0f, 1.0f);
    anim.setDuration(100); //You can manage the blinking time with this parameter
    anim.setStartOffset(20);
    anim.setRepeatMode(Animation.REVERSE);
    anim.setRepeatCount(Animation.INFINITE);*/
    
}
 
Example 19
Project: Mvcs   File: MvcsLogSample.java   View Source Code Vote up 4 votes
@OnClick(R.id.bt_clear_log)
public void onClickClearLog(View v){
    TextView tv = getController().getViewHelper().getView(R.id.et_log);
    tv.setText("");
    tv.setHint("Log is cleaned.");
}
 
Example 20
Project: android_Json2view   File: AdapterHelper.java   View Source Code Vote up 4 votes
public void setHint(int viewId, String value) {
    TextView view = retrieveView(viewId);
    view.setHint(value);
}