Jest to błąd otrzymuję: W/TextView: TextView does not support text selection. Selection cancelled.
Android TextView nie można wybrać w CoordinatorLayout? (TextView nie obsługuje zaznaczenie tekstu Wybór wyłączony.)
Jestem zaskoczony, bo inne I wprowadziły wcześniej w RelativeLayout
mieli zaznaczanie tekstu, kiedy mają właściwość android:textIsSelectable="true"
- jednak tym razem nie działa.
Ten kod znajduje się pod app_bar_main.xml
przy użyciu słowa kluczowego include
w formacie XML.
Oto app_bar_main.xml
:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".MainActivity">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
>
</android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_main" /> //This is where the textview is added!
</android.support.design.widget.CoordinatorLayout>
Oto edytowany content_main.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="#ffffff"
android:orientation="vertical"
tools:context="com.androidterminal.MainActivity"
tools:showIn="@layout/app_bar_main">
//I have some other LinearLayouts here
<RelativeLayout
android:id="@+id/ll5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/ll2"
android:orientation="horizontal">
<TextView
android:id="@+id/main1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorGrey"
android:textIsSelectable="true"
android:textColor="#000000" />
</RelativeLayout>
</RelativeLayout>
Ten TextView main1
nie jest wybierany i rzuca ww ostrzeżenie na LogCat. Proszę pomóż. Dzięki. (Próbowałem już ustawiania właściwości aktywowana i setFocusable)
czy możesz dodać @ style/AppTheme.PopupOverlay, @ style/ToolbarTitle. ??? beause próbowałem Twojego kodu ..i nie mam twoich stylów, więc usunąłem to z xml i działa ... to wybiera tekst ... mogę pokazać ci zrzut ekranu .. –
Masz do czynienia z tym problemem w konkretnej wersji Androida lub na telefony? Spróbuj użyć android: focusable = "true" w swoim widoku tekstowym. –
Spróbuj także użyć Androida: enabled = "true" –