android spinner text 太长 最后省略("..."),怎么实现Androidspinner省略
解决方案 »
- 点短信按钮之后显示我的程序
- android开发时遇到的错误
- 如何实现自己给自己发短信
- 如何根据包名packageName获取程序启动的主Activity名称?
- android 添加联系人界面 如何判断正在编辑的联系人内容变化?
- xml及xsl在android中的显示
- Android连接firebird数据库时报错,如何解决谢谢:)
- 求一个使用安卓手机音频口输出正弦(方波)信号的小demo
- 请问关于listview点击的时候,显示的问题
- ionic4 调试工具 devapp 在安卓上怎么安装呢?ionic4 调试工具 devapp 在安卓上怎么安装呢?
- 安卓/linux中怎样调用原有的JNI so库函数
- android handler 同时处理多条消息
android:maxLength="16" //设置最长字符数,会自动将多余的文字省略
ellipsize属性是textview特有的,spinner不能用呀!我也试了
这个是布局
<Spinner
android:id="@+id/questionSpinner"
android:layout_width="0dp"
android:layout_height="@dimen/editViewSize"
android:layout_weight="1"
android:animationCache="true"
android:background="@drawable/spinner_background"
android:drawSelectorOnTop="true"
android:paddingLeft="@dimen/baSize"
android:prompt="@string/selectquestion"
android:spinnerMode="dropdown"
android:textColor="#000000"
android:textSize="@dimen/slSize" /> <string name="selectquestion">please click on the security problems</string> <string-array name="question">
<item>Please click on the security problems</item>
<item>Who is your favorite star?</item>
<item>What is your favorite pet?</item>
<item>What is your favorite food?</item>
<item>Which college did you graduate from?</item>
<item>Which company your first job in?</item>
</string-array>本来是想着只要修改了selectquestion的内容就可以改变当不点击的时候提示内容,但是没有效果,而是修改了array-》question的地一个item,给影响了默认的提示内容代码中的
questionSpinner = (Spinner) findViewById(R.id.questionSpinner);
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(
vcontext, R.array.question, R.layout.spinnertext);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_item);
questionSpinner.setAdapter(adapter);
questionSpinner.setOnItemSelectedListener(new OnItemSelectedListener() {
public void onItemSelected(AdapterView<?> parent, View view,
int pos, long id) {
question = parent.getItemAtPosition(pos).toString();
position = pos;
} public void onNothingSelected(AdapterView<?> parent) {
question = vcontext.getString(R.string.selectquestion)
.toString();
}
});
差不多,能给个具体代码看看吗?
差不多,能给个具体代码看看吗?
给个邮箱吧
[email protected]谢了
差不多,能给个具体代码看看吗?
差不多,能给个具体代码看看吗?
给个邮箱吧
[email protected]谢了
差不多,能给个具体代码看看吗?
差不多,能给个具体代码看看吗?
给个邮箱吧
[email protected]谢了发过去了