天道酬勤,学无止境

textview

Textview in android fragment duplicated in landscape layout

I am trying to make an app with two fragments, one containing a list of groups (called OverviewFragment) and one fragment containing the details of selected group (called DetailsFragment). I want only one fragment to be visible at a time in portrait mode and both to be visible simultaneously in landscape mode. I have two problems. First of all the transition between portrait and landscape is very unstable and leads to a variety of crashes, i.e: a blank screen, "No view found", "Error inflating class fragment" and "overlapping rendering". My other more concrete problem is that when in landscape

2021-10-25 23:55:43    分类:问答    android   textview   fragment   landscape

尝试制作一个包含 40 列或字符的文本控制台(trying to make a text console with 40 columns or characters)

问题 我正在扩展 MultiAutoCompleteTextView 并将字体设置为此字体 Unicode 字体 这是我声明它的xml <jacs.apps.jacs.CustomViews.Console android:id="@+id/auto" android:layout_width="match_parent" android:layout_height="wrap_content" android:dropDownAnchor="@id/content_frame" android:dropDownHeight="100dp" android:layout_weight="1" android:gravity="bottom" android:inputType="textMultiLine|textNoSuggestions" android:fontFamily="@font/unifont" android:imeOptions="actionDone" android:scrollbars="vertical" android:scrollHorizontally="false" android:singleLine="false" android:typeface="monospace" /> 这是我的班级 class Console

2021-10-25 23:13:35    分类:技术分享    android   kotlin   view   fonts   textview

如何使 setOnClickListener 能够更新值(How to make setOnClickListener capable of updating value)

问题 我是 android 新手,我需要一些帮助。 我有四个文本视图,其中之一是可点击的: clickableTextView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { clickableTextView具有的价值textview1 ,但里面setOnClickListener的clickableTextView需要的值textview2最前一页点击后,第二次点击需要的值之后textview3等.. 意思是:第一次是可点击的textview1 ,第二次是可点击的textview2 ,第三次是textview3等等.. 但即使为什么clickableTextView使用确切的值,每次第一个 textview 时setOnClickListener , setOnClickListener也不会更新clickableTextView的新值。 有人可以帮助我我该怎么做? 这是代码: correctAnswerHolder.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Log.e("correctAnswerHolder"

2021-10-25 20:36:31    分类:技术分享    android   textview   onclicklistener

每个字母都有不同颜色的 Android 选框(Android marquee where each letter has different color)

问题 我有一个简单的 TextView 选框(在 LinearLayout 内)。 我需要每个字母都有不同的颜色。 有谁知道我怎么能做到这一点? 文本是预定义的,因此我可以根据需要对所有内容进行硬编码。 这是我的 TextView <TextView style="@style/myFont" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="0.45" android:ellipsize="marquee" android:lines="1" android:marqueeRepeatLimit="marquee_forever" android:text="@string/my_text" /> 说文本是“Hello world!我很高兴!” 回答1 使用 Html.fromHtml() 并设置文本。 randomColor = https://stackoverflow.com/a/4246400/1008278 XML 中的颜色列表 >> https://gist.github.com/VenomVendor/6857539 修改为 StringArray String tempText = "Hello world! I am happy!"

2021-10-25 20:07:36    分类:技术分享    android   android-layout   textview

Android Adding more than one TextView to a TableRow Programmatically

I have a LinearLayout inside a FrameLayout for tab purposes. And I'm trying to add TableRow's to the LinearLayout in the code. LinearLayout testLayout = (LinearLayout)findViewById(R.id.testLayout); TableRow tableRow = new TableRow(this); tableRow.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT)); This gets my LinearLayout and creates a TableRow to the specifications I want. I know this part is working. TextView textOne = new TextView(this); textOne.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT)); textOne.setText("One")

2021-10-25 18:09:02    分类:问答    android   textview   android-linearlayout   tablerow

textView 在第一行滚动(textView scroll at first line)

问题 我想在我知道的文本的某些部分滚动我的 TextView,并将其显示在顶部。 这是我的滚动视图和文本视图: <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:scrollbars="vertical" android:id="@+id/scroll" android:layout_width="match_parent" android:layout_height="match_parent"> <TextView android:id="@+id/text" android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="16dp"/> </ScrollView> 我的文本是一个字符串数组: ScrollView scroll= (ScrollView) getActivity().findViewById(R.id.scroll); TextView text = (TextView) getActivity().findViewById(R.id.text); String book =""; for(String line: lines){ book

2021-10-25 16:22:29    分类:技术分享    android   scroll   textview   android-scrollview

Android:向 Actionbar Spinner 添加两个 TextView(Android: Add two TextViews to Actionbar Spinner)

问题 无论如何要在 Actionbar Spinner 中添加两个文本视图或字符串? 类似于 Android GMAIL 应用程序的工作方式。 回答1 您可以使用自定义 ArrayAdapter: public class spinnerAdapter extends ArrayAdapter { private LayoutInflater inflater; public spinnerAdapter(Context context, int textViewResourceId) { super(context, textViewResourceId); inflater = LayoutInflater.from(context); } @Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder; if(convertView == null){ holder = new ViewHolder(); convertView = inflater.inflate(R.layout.spinner_text_layout, null); holder.text1 = (TextView)convertView.findViewById(R

2021-10-25 15:57:55    分类:技术分享    android   textview   android-actionbar   spinner

Jsoup display data to textview

I parsed a html web page with jsoup. now i want to display my parsed data in my textview. code String ID = loginpreferences.getString("ID", null); String Type = loginpreferences.getString("Type", null); String myURL = "http://roosters.gepro-osi.nl/roosters/rooster.php?leerling="+ID+"&type=Leerlingrooster&afdeling="+Type+"&tabblad=2&school=905"; Document doc = null; try { doc = Jsoup.connect(myURL).get(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } Elements data = doc.select(".1nameheader"); } } I tried Textview1.SetText(data); But that didn't work.

2021-10-25 15:51:58    分类:问答    java   android   parsing   textview   jsoup

Use EditText in a DialogFragment to change TextView in Main Activity?

So I'm working on my first real attempt at an Android app, just a simple scorekeeper for softball games. I've got it tallying scores, outs, etc, and right now it just displays "Home" and "Away." I'd like to give users the chance to enter in actual team names. To this effect, I added a custom AlertDialog that pops up with an EditText, so when you hit "OK" it'll update the Home/Away team name. The problem is I've been Googling this for most of the week and I've not found a single way to actually do this. I've tried tagging the fragment's layout XML so I can find the EditText, but it always gives

2021-10-25 14:17:41    分类:问答    android   textview   fragment   android-alertdialog   editview

改变方向后虚线下划线位置改变(Dotted underline position changed after changing orientation)

问题 我已经从下面的链接 Dotted underline TextView not wrapping to next line using SpannableString in Android 完成了多行文本支持 将方向纵向更改为横向后,虚线下划线移动到其他位置 我在清单中添加了 'android:configChanges="orientation"' 以防止创建调用。 <activity android:name=".Main2Activity" android:configChanges="orientation"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> setAnnotation( spannableString, "production and conversion" ) 肖像: 风景: 回答1 参考您在本问题中提到的原始问题,并假设您使用的是原始问题中的“DottedUnderlineSpan”,您需要进行以下更改: 注释跨度被替换为ReplacementSpans ,一旦您自己处理方向更改

2021-10-25 12:45:08    分类:技术分享    android   textview   spannablestring