私はここで次の問題を取り除くために何時間も努力していますが、私がここや他のサイトで見つけたメソッドを検索して適用しました。 Screenshot of cut off textText in singleLine HorizontalScrollView内のListView内のTextViewが切断されました
これは私のxml一部です::次のスクリーンショットを見てください
<HorizontalScrollView
android:layout_width="367dp"
android:layout_height="355dp"
android:layout_marginLeft="0dp"
android:layout_marginRight="0dp"
android:layout_marginTop="8dp"
android:fillViewport="true"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/btn_search">
<ListView
android:id="@+id/listView_results"
style="@android:style/Widget.DeviceDefault.Light.ListView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="16dp"
android:background="@android:color/black"
android:clickable="true"
android:divider="@android:color/holo_orange_light"
android:dividerHeight="1dp"
android:scrollbars="horizontal|vertical"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/btn_search" />
</HorizontalScrollView>
そして、これは私が私のJavaファイルに書かれたものです:
`
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, titleList) {
@Override
public View getView(int position, View convertView, ViewGroup parent){
// Get the Item from ListView
View view = super.getView(position, convertView, parent);
TextView tv = (TextView) view.findViewById(android.R.id.text1);
// Set the text size in ListView for each item
tv.setTextSize(TypedValue.COMPLEX_UNIT_DIP,40);
tv.setSingleLine(true);
tv.setMaxLines(1);
tv.setHorizontallyScrolling(true);
tv.setHorizontalScrollBarEnabled(true);
//tv.setEllipsize(MARQUEE);
//tv.setMarqueeRepeatLimit(1000);
// Return the view
return view;
}
};`
ご覧のとおり、マーキーオプションを試しましたが、効果はありませんでした。 私が見つけた情報源がまったく手伝ってくれなかったので、誰かがどこで解決策を読むか知っていれば誰でもできます。何か提案があれば、私はそれらを読むことができます。私は彼らの助けを事前に誰にも感謝したい。これは大学のプロジェクトと私の最初のAndroidアプリケーションです - いくつかの合併症があります^^。
TextViewやListView、HorizontalScollViewの幅に制限があるのか、そうであれば拡張できるのかどうかは疑問でした。
乾杯 Durim
こんにちは、残念ながら助けにはなりません。私もlayout_widthをtextViewsから "wrap_content"に設定しようとしましたが、変更は気付かれませんでした。 – Durim