我有一个 EditText。
当我的字符少于 8 个时,EditText 有一个最小宽度。
我想使用 wrap_content。
是hint引起的
我该如何解决这个问题? 我什么都试过了。
我想要这样:
这是我的代码
<EditText
android:id="@+id/et_actionbar_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="YOLO"
android:hint="New team"
android:gravity="center"
android:textColor="@color/gray1"
android:textStyle="bold"
android:background="@color/gold"
android:layout_centerInParent="true"
android:minWidth="0dp"
android:minEms="0"
android:minHeight="0dp"
android:paddingLeft="0dp"
android:layout_marginLeft="0dp"
/>
最佳答案
做到这一点的唯一方法是删除提示或减少提示字符串的长度。 如果您不想删除提示,请在将文本输入到 EditText 时将其隐藏。
editText.addTextChangedListener(new TextWatcher() {
@Override
public void onTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {
if(!TextUtils.isEmpty(editText.getText().toString())){
editText.setHint("");
}else{
edittext.setHint(R.string.hint);
}
}
@Override
public void beforeTextChanged(CharSequence arg0, int arg1, int arg2,
int arg3) {
// TODO Auto-generated method stub
}
@Override
public void afterTextChanged(Editable arg0) {
// TODO Auto-generated method stub
}
});
关于Android EditText 宽度因为提示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23290495/
我想在IRB中浏览文件系统并让提示更改以反射(reflect)当前工作目录,但我不知道如何在每个命令后进行提示更新。最终,我想在日常工作中更多地使用IRB,让bash溜走。我在我的.irbrc中试过这个:require'fileutils'includeFileUtilsIRB.conf[:PROMPT][:CUSTOM]={:PROMPT_N=>"\e[1m:\e[m",:PROMPT_I=>"\e[1m#{pwd}>\e[m",:PROMPT_S=>"FOO",:PROMPT_C=>"\e[1m#{pwd}>\e[m",:RETURN=>""}IRB.conf[:PROMPT_MO
我有一个Highstock图表(带有标记和阴影的线条),并且想以编程方式显示一个highstock工具提示,例如,当我选择某个表上的一行(包含图表数据)我想显示相应的highstock工具提示。这可能吗? 最佳答案 股票图表thissolution不起作用:在thisexample你必须更换这个:chart.tooltip.refresh(chart.series[0].data[i]);为此:chart.tooltip.refresh([chart.series[0].points[i]]);解决方案可用here.
我已经安装了最新版本的compass、sass和susy。但我仍然收到此错误:Unabletoactivatesusy-2.1.1,becausesass-3.2.17conflictswithsass(~>3.3.0)有人知道这个Ruby是如何工作的吗?这是我安装的gem的列表:***LOCALGEMS***CFPropertyList(2.2.0)chunky_png(1.3.0)compass(0.12.4)compass-core(1.0.0.alpha.19)compass-import-once(1.0.4)compass-rails(1.1.3)fssm(0.2.10)l
使用Ruby,我必须将字符串以柱状格式输出到终端。像这样:|row1|astringhere|etc|row2|anotherstring|etc我可以使用String#ljust和%s处理拉丁UTF8字符。但是当字符是韩文、中文等时就会出现问题。当英文行与包含韩文等的行交错时,列根本不会对齐。如何在此处实现列对齐?有没有办法以等同于固定宽度字体的方式输出亚洲字符?对于要在Vim中显示和编辑的文档怎么样? 最佳答案 您的问题发生在CJK(中文/日文/韩文)full-widthandwidecharacters(也向下滚动图表);这些
废话不多先看bug解决方案在下面!!!!启动服务查看服务是否开启首先我的电脑-右键-管理-服务和应用程序-服务-找到IPsecPolicyAgent-右键属性-启动方式改为自动,并重启服务,如下图打开设置-更改适配器选项如下图点击连接失败的连接-右键-属性-安全-允许使用这些协议编辑注册表按Ctrl+R打开命令行窗口输入regedit打开注册表输入下面命令进入以下页面HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\RasMan\Parameters如下图在右侧编辑菜单上,鼠标右键新建,然后单击DWORD(32)位值。键入Prohibit
我在Rubyrails上,我正在安装RubyonRails。我正在尝试安装gems,但它没有发生,我不确定为什么以及如何修复它。$geminstallbundlerERROR:Loadingcommand:install(LoadError)dlopen(/Users/nthulanemakgato/.rbenv/versions/2.1.1/lib/ruby/2.1.0/x86_64-darwin13.0/openssl.bundle,9):Librarynotloaded:/usr/local/opt/openssl/lib/libssl.1.0.0.dylibReferenced
我正在使用事件资源从api获取数据并显示它,我的Controllermodel.rb有classThr::Vol::Dom'/vv/test/domains/2013-06-25T05:03Z')xendend当我调用Thr::Vol::Dom.find方法时,它返回以下错误:ArgumentError:expectedanattributesHash,got["0.0.0.0","1.1.1.1","2.2.2.2","3.3.3.3","4.4.4.4"]该api应该提供这样的内容{"abs.com":["0.0.0.0","1.1.1.1","2.2.2.2","3.3.3.3"
String.length只会告诉我字符串中有多少个字符。(其实在Ruby1.9之前,它只会告诉我多少个字节,这就更没用了。)我真的很想知道一个字符串有多少个“en”宽。例如:'foo'.width#=>3'moo'.width#=>3.5#m's,w's,etc.arewide'foi'.width#=>2.5#i's,j's,etc.arenarrow'foobar'.width#=>6.25#spacesareverynarrow如果我能得到字符串的第一个n就更好了:'foo'[0,2.en]#=>"fo"'filial'[0,3.en]#=>"fili"'foobarbaz'[
我刚刚经历了这个概念Zero-WidthAssertions从文档中。我想到了一些快速的问题-为什么这样的名字Zero-WidthAssertions?Look-ahead怎么了和look-behind概念支持这样的Zero-WidthAssertions概念?什么这样的?,,=s,-4个符号在模式内指示?你能帮我集中精力了解实际发生的事情我还尝试了一些小代码来理解逻辑,但对它们的输出没有那么自信:irb(main):001:0>"foresight".sub(/(?!s)ight/,'ee')=>"foresee"irb(main):002:0>"foresight".sub(/(?
我添加到我的.irbrc:IRB.conf[:PROMPT].reverse_merge!(:RAILS_ENV=>{:PROMPT_I=>"#{current_app}#{rails_env}#{prompt}",:PROMPT_N=>"#{current_app}#{rails_env}#{prompt}",:PROMPT_S=>nil,:PROMPT_C=>"?>",:RETURN=>"=>%s\n"})IRB.conf[:PROMPT_MODE]=:RAILS_ENV如果我这样做:current_app="\e[31mfoo_bar_app\e[0m"rails_env="\e