5

android:textisselectableという属性を持つフローティングウィンドウにTextViewを追加しています。android:textisselectableがTYPE_SYSTEM_ALERTウィンドウで機能しない

mWindowManager.addView(textView, params); 

長時間押してもテキストをコピーできないことを除いて、Eveythingはうまくいきます。奇妙な部分は、それはギャラクシータブでは正常に動作しているが、私は持っている他の5インチの携帯電話ではないということです。

+0

textisselectableとpopupWindowとscrollview文句を言わない仕事:

は、このコードを試してみてください。たぶんそのアンドロイドのバグ –

+0

'ScrollView'はありませんし、質問が小さな5インチデバイスではないタブレットでうまく働いていると言われています。 – mjosh

答えて

2

バージョンの問題だと思います。ギャラクシータブにはハニカム以上のバージョンがありますが、5インチのスクリーンはハニカム以下のバージョンがあります。

TextView textView; 
String stringToBeExtracted; 
int startingIndex=textView.getSelectionStart(); 
int endingIndex=textView.getSelectionEnd(); 
stringToBeExtracted = stringYouExtracted.subString(startingIndex, endingIndex); 
if(android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB) { 
    android.text.ClipboardManager clipboard = (android.text.ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE); 
    clipboard.setText(stringToBeExtracted); 
} else { 
    android.content.ClipboardManager clipboard = (android.content.ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE); 
    android.content.ClipData clip = android.content.ClipData.newPlainText("Text Copied", stringToBeExtracted); 
      clipboard.setPrimaryClip(clip); 
} 
+0

私は自分のアプリで最低限のAPI 14を使用しています。 – mjosh

+0

使用している5インチ画面のデバイス名は何ですか? – Lampard

関連する問題