Очередная андроидная попоболь
Feb. 2nd, 2017 08:33 pmВот есть у вас текста кусок:
TableRow
android:background="#cccccc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scrollIndicators="start|right|end"
android:layout_margin="2dp"
>
TableRow
android:background="#cccccc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scrollIndicators="start|right|end"
android:layout_margin="2dp"
>
[Error: Irreparable invalid markup ('<textview [...] <b>') in entry. Owner must fix manually. Raw contents below.]
Вот есть у вас текста кусок:
<cut>
TableRow
android:background="#cccccc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scrollIndicators="start|right|end"
android:layout_margin="2dp"
>
<TextView
android:id="@+id/about2"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="123456"
android:background="#E0FFFF"
<b> android:clickable="true"
android:onClick="onClick_testchange_textcolor"
</b> />
/TableRow
<hr>
окей. И функция, простая:
public void onClick_testchange_textcolor(View view) {
// тестирование смены цветов. По онклик
// http://developer.alexanderklimov.ru/android/views/textview.php
// http://developer.alexanderklimov.ru/android/trafficlights.php
TextView change_color = (TextView)findViewById(R.id.about2);
String change_color_onclick = "строка для смены текста";
change_color.setText(change_color_onclick);
}
Все отлично, все збс. Ну, кроме того что не цвет текста меняется, а сам текст.
Теперь вторая часть. Есть 300 (триста) таких текстовых полей, и у каждого свой id - в данном примере - about2
Значит, надо в каждый формируемый текствью вписать android:clickable="true
и собсно вызов функции, да еще этот ID передать в нее как параметр.
ОхЪ наплакаюсь.
</cut>
<cut>
TableRow
android:background="#cccccc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scrollIndicators="start|right|end"
android:layout_margin="2dp"
>
<TextView
android:id="@+id/about2"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="123456"
android:background="#E0FFFF"
<b> android:clickable="true"
android:onClick="onClick_testchange_textcolor"
</b> />
/TableRow
<hr>
окей. И функция, простая:
public void onClick_testchange_textcolor(View view) {
// тестирование смены цветов. По онклик
// http://developer.alexanderklimov.ru/android/views/textview.php
// http://developer.alexanderklimov.ru/android/trafficlights.php
TextView change_color = (TextView)findViewById(R.id.about2);
String change_color_onclick = "строка для смены текста";
change_color.setText(change_color_onclick);
}
Все отлично, все збс. Ну, кроме того что не цвет текста меняется, а сам текст.
Теперь вторая часть. Есть 300 (триста) таких текстовых полей, и у каждого свой id - в данном примере - about2
Значит, надо в каждый формируемый текствью вписать android:clickable="true
и собсно вызов функции, да еще этот ID передать в нее как параметр.
ОхЪ наплакаюсь.
</cut>