我试过使用marquee,它不在这里工作是我的代码,请让我知道我哪里出错了
<TextView
android:text="lunch 20.00 | Dinner 60.00 | Travel 60.00 | Doctor 5000.00 | lunch 20.00 | Dinner 60.00 | Travel 60.00 | Doctor 5000.00"
android:id="@+id/TextView02"
android:layout_width="200dip"
android:layout_height="wrap_content"
android:marqueeRepeatLimit="marquee_forever"
android:ellipsize="marquee"
android:singleLine="true"
android:focusable="true"
android:inputType="text"
android:maxLines="1">
</TextView>
Run Code Online (Sandbox Code Playgroud)
我正在使用android SDK 2.0.1
在Android中有Marquee的任何工作示例吗?我浏览了一些网站,但这些例子都没有用.
谢谢你的答案..但是以下代码无论如何都没有用.我使用的是Android 2.2.
<TextView
android:singleLine="true"
android:ellipsize="marquee"
android:marqueeRepeatLimit ="marquee_forever"
android:text="Marquee.."/>
Run Code Online (Sandbox Code Playgroud) 我正在开发一个AppWidget我需要一个TextView显示文本作为选框的地方.我已经尝试使用以下代码(正如常规中所做的那样Activity),但文本不会滚动.
<TextView
android:layout_width="150dip"
android:layout_height="wrap_content"
android:text="@string/marquee_forever"
android:singleLine="true"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever" />
Run Code Online (Sandbox Code Playgroud)
谁能告诉我如何解决这个问题?
我面临的问题是android:ellipsize在TextView中不起作用.但要适用于android:singleLine.
我听说android:singleLine是"Deprecated",但它不是在Android Developer的引用中写的.
https://developer.android.com/reference/android/widget/TextView.html#attr_android:singleLine
android:singleLine不再处于"弃用"状态?
补充: 我自己解决了这个问题.
事实证明,TextView的属性的android:scrollHorizontally ="true"没有反映在xml文件中.
所以,我尝试使用setHorizontallyScrolling方法,它起作用了.
*xml:*
<TextView
android:id="@+id/text"
android:ellipsize="end"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
*code:*
TextView textView = (TextView)findViewByID(R.id.text);
textView.setHorizontallyScrolling(true);
Run Code Online (Sandbox Code Playgroud)
但是,我在xml中添加"android:inputType ="text",如下所示,它不起作用.请小心.
*xml:*
<TextView
android:id="@+id/text"
**android:inputType="text"**
android:ellipsize="end"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
Run Code Online (Sandbox Code Playgroud) 我刚尝试TextView在Android 4.0.3中实现淡入淡出效果; 但是,它不起作用.
fadingEdge="horizontal"
singleLine="true"
ellipsize="marquee"
Run Code Online (Sandbox Code Playgroud)
此代码适用于2.3.7及更低版本,但不适用于4.0.3.我想知道为什么会这样?以及如何使褪色效果TextView?
我的问题与此问题相同:http://groups.google.com/group/android-developers/browse_thread/thread/97131b20de8b2ebd,但尚未回答.
注意:好的,我承认标题有点模糊,但英语不是我的主要语言,我不知道如何在一个标准中描述问题.
我正在尝试创建一个在gridView上显示所有应用信息的应用.
gridView将其numColumns设置为auto_fit,以便为所有类型的屏幕很好地设置其列数.
由于每个应用程序的信息有时可能很长,因此单元格高度可能与其旁边的单元格高度不同.
我希望网格单元具有相同的宽度(在所有情况下都可以正常工作),并且对于每一行,高度应由行的单元格的最大高度确定.
这会导致奇怪的事情发生:
以下是显示#2和#3问题的屏幕截图(它们通常不会一起显示):

这是网格单元格的xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/list_divider_holo_dark" >
<ImageView
android:id="@+id/appIconImageView"
android:layout_width="48dip"
android:layout_height="48dip"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:adjustViewBounds="true"
android:contentDescription="@string/app_icon"
android:src="@drawable/ic_menu_help" />
<TextView
android:id="@+id/appLabelTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toLeftOf="@+id/isSystemAppImageView"
android:layout_toRightOf="@+id/appIconImageView"
android:ellipsize="marquee"
android:text="label"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textStyle="bold"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/appDescriptionTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/appLabelTextView"
android:layout_below="@+id/appLabelTextView"
android:layout_toLeftOf="@+id/isSystemAppImageView"
android:ellipsize="marquee"
android:text="description"
tools:ignore="HardcodedText" />
<ImageView
android:id="@+id/isSystemAppImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/appDescriptionTextView"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:adjustViewBounds="true"
android:contentDescription="@string/content_description_this_is_a_system_app"
android:src="@drawable/stat_sys_warning" />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
我尝试了多种可能的解决方案:
使用HorizontalListView似乎解决了这个问题,但它不允许点击/长按项目.
我找到了一个很好的库,使textViews有一个"选框"效果(这里),但它的许可证不是那么宽松.
将单元格高度设置为固定高度或将textViews设置为具有固定行数也可以工作,但是它会减少(部分)textViews的内容而无法显示它们.
我也尝试使用linearLayouts而不是RelativeLayout,但它没有帮助.
一个可能的解决方案是获取gridView上所有视图使用的最大高度(在所有项目上使用getView),类似于 …
我有一个带有一些文本的TextView,我想让它用滚动的选框动画制作动画.我看到了关于强制选框动画的这个流行问题,但是答案中的代码只有在文本足够长以超出TextView的边界(因此文本被截断)时才起作用,我正在寻找永久性的解决方案无论文本的宽度如何,都要使文本具有此选取框动画; 这可能吗?
我有LinearLayout和内部2 TextView都有选框,当我在第一次更新文本然后第二个TextView重新启动选框.
<LinearLayout
android:id="@+id/panel"
android:layout_width="320dp"
android:layout_height="match_parent"
android:layout_marginLeft="2dp"
android:layout_marginRight="2dp"
android:gravity="center_vertical"
android:orientation="vertical" >
<TextView
android:id="@+id/first"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:gravity="bottom|center_horizontal"
android:marqueeRepeatLimit="marquee_forever"
android:singleLine="true" />
<TextView
android:id="@+id/second"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:gravity="top|center_horizontal"
android:marqueeRepeatLimit="marquee_forever"
android:singleLine="true"
/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
我发现如果为R.id.first和R.id.second我设置layout_width="320dp"的效果不会发生.但我想设置android:layout_width="match_parent"一些解决方法?
我发现类似的问题,但没有解决方案: Android,RelativeLayout在同一RelativeLayout中更改ImageView时重新启动Marquee-TextView
我应该在参数中放置什么值才能使选取框重复限制为永久?
holder.hTextTitle.setEllipsize(TruncateAt.MARQUEE);
holder.hTextTitle.setMarqueeRepeatLimit();
Run Code Online (Sandbox Code Playgroud) android ×10
textview ×6
marquee ×5
android-4.0-ice-cream-sandwich ×1
animation ×1
deprecated ×1