バックグラウンド
いくつかの設定を持つアプリを作成しており、ジョブに組み込みの PreferenceActivity または PreferenceFragment を使用したい
問題
一部の設定には、短縮できない長いタイトルがあり、アプリをローカライズ (複数の言語に翻訳) すると、同じ問題に直面すると思います (たとえば、非常に長い単語を含むドイツ語など)。
この状況で得られるのは、テキストの始まりに過ぎず、最後に "..." (またはドットが少ないため、あまり意味がありません) です。
例:
私が試したこと
PreferenceActivity が ListActivity から拡張されていることはわかっているので、そのアダプターを好きなように変更できますが、それでは機能が失われてしまいます。
また、設定クラスの各タイプから拡張し、「onCreateView」メソッドを使用して作成されたビューへの参照を取得し、その子にアクセスできることも知っていますが、これは奇妙ですよね? つまり、見た目は決して変わらないと思い込んでいるようなものです。
編集:これは私が試したもののサンプルコードです:
各設定クラスから拡張し、それぞれで以下を使用します。
...
@Override
protected View onCreateView(final ViewGroup parent)
{
final View view=super.onCreateView(parent);
ViewUtil.handlePreferenceTitleTextView(view);
return view;
}
...
//ViewUtil.java :
private void handlePreferenceTitleTextView(final View v)
{
final TextView titleTextView=(TextView)v.findViewById(android.R.id.title);
if(titleTextView!=null)
titleTextView.setSingleLine(false);
}
動作しますが、Google が設定ビューの動作方法を変更する可能性があるため、お勧めしません。
質問
Android の環境設定のタイトルで長いテキストを処理するにはどうすればよいですか?
楕円形/マーキーを持たせることは可能ですか (すべてを表示するアニメーションを持つように) ? または、フォントサイズを自動調整しますか?またはワードラップを持つように設定しますか?または、ユーザーがスクロールして残りのテキストを読むことができる水平スクロールビューですか?
そのような場合を処理する方法の慣例はありますか?テキスト全体を表示するために、長押ししてトースト/ダイアログを表示することはありますか?