简体   繁体   English

Android - Material Design 中的 TextView 使用支持库

[英]Android - TextView in Material Design using Support Library

how can I make TextView in Material Design using Support Library by code (inside AlertDialog)?如何通过代码(在 AlertDialog 内)使用支持库在 Material Design 中制作 TextView?

My code (doesn't work):我的代码(不起作用):

   AlertDialog.Builder alert = new AlertDialog.Builder(this, R.style.AppCompatAlertDialogStyle);

   final TextInputLayout input = new TextInputLayout(this);
   input.addView(new EditText(this));
   input.getEditText().setHint(R.string.enter_pass);

   alert.setView(input);

I solved it.我解决了。 It should be它应该是

input.setHint(getString(R.string.enter_pass));

not不是

input.getEditText().setHint(R.string.enter_pass);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM