<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Форум Александра Климова — Светофор]]></title>
		<link>http://forum.alexanderklimov.ru/viewtopic.php?id=7</link>
		<atom:link href="http://forum.alexanderklimov.ru/extern.php?action=feed&amp;tid=7&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Светофор.]]></description>
		<lastBuildDate>Wed, 26 Jan 2022 19:30:03 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Светофор]]></title>
			<link>http://forum.alexanderklimov.ru/viewtopic.php?pid=1191#p1191</link>
			<description><![CDATA[<p>Я предпочитаю по старинке через findViewById. Но можно и через view bindings</p>]]></description>
			<author><![CDATA[null@example.com (alexander.klimoff)]]></author>
			<pubDate>Wed, 26 Jan 2022 19:30:03 +0000</pubDate>
			<guid>http://forum.alexanderklimov.ru/viewtopic.php?pid=1191#p1191</guid>
		</item>
		<item>
			<title><![CDATA[Re: Светофор]]></title>
			<link>http://forum.alexanderklimov.ru/viewtopic.php?pid=1190#p1190</link>
			<description><![CDATA[<p>Правильно понимаю, что на данный момент лучше выполнять задания через view bindings так как Kotlin Android Extensions устарел?</p>]]></description>
			<author><![CDATA[null@example.com (HellDHound)]]></author>
			<pubDate>Wed, 26 Jan 2022 16:04:52 +0000</pubDate>
			<guid>http://forum.alexanderklimov.ru/viewtopic.php?pid=1190#p1190</guid>
		</item>
		<item>
			<title><![CDATA[Re: Светофор]]></title>
			<link>http://forum.alexanderklimov.ru/viewtopic.php?pid=1184#p1184</link>
			<description><![CDATA[<p>Почему бы за места&nbsp; mConstraintLayout.setBackgroundColor(ContextCompat.getColor(this, R.color.greenColor));<br />не использовать mConstraintLayout.setBackgroundResource(R.color.greenColor);<br />тоже работает и проще.<br />В чем разница?</p>]]></description>
			<author><![CDATA[null@example.com (Fashick5)]]></author>
			<pubDate>Fri, 06 Nov 2020 08:58:29 +0000</pubDate>
			<guid>http://forum.alexanderklimov.ru/viewtopic.php?pid=1184#p1184</guid>
		</item>
		<item>
			<title><![CDATA[Re: Светофор]]></title>
			<link>http://forum.alexanderklimov.ru/viewtopic.php?pid=1177#p1177</link>
			<description><![CDATA[<p>вот так на Kotlin(может я ошибку написал, но работает)</p><p>package com.android.trafficlight</p><p>import androidx.appcompat.app.AppCompatActivity<br />import android.os.Bundle</p><br /><p>import androidx.core.content.ContextCompat<br />import kotlinx.android.synthetic.main.activity_main.*</p><br /><br /><br /><p>class MainActivity : AppCompatActivity() {</p><br /><p>&nbsp; &nbsp; override fun onCreate(savedInstanceState: Bundle?) {<br />&nbsp; &nbsp; &nbsp; &nbsp; super.onCreate(savedInstanceState)<br />&nbsp; &nbsp; &nbsp; &nbsp; setContentView(R.layout.activity_main)</p><p>&nbsp; &nbsp; &nbsp; &nbsp; buttonRed.setOnClickListener {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; textView.setText(R.string.Red)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; constraintLayout.setBackgroundColor(ContextCompat.getColor(this, R.color.redColor))<br />&nbsp; &nbsp; &nbsp; &nbsp; }<br />&nbsp; &nbsp; &nbsp; &nbsp; buttonYellow.setOnClickListener {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; textView.setText(R.string.Yellow)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; constraintLayout.setBackgroundColor(ContextCompat.getColor(this, R.color.yellowColor))<br />&nbsp; &nbsp; &nbsp; &nbsp; }<br />&nbsp; &nbsp; &nbsp; &nbsp; buttonGreen.setOnClickListener {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; textView.setText(R.string.Green)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; constraintLayout.setBackgroundColor(ContextCompat.getColor(this, R.color.greenColor))<br />&nbsp; &nbsp; &nbsp; &nbsp; }</p><p>&nbsp; &nbsp; &nbsp; &nbsp; }</p><br /><p>}</p>]]></description>
			<author><![CDATA[null@example.com (abstred)]]></author>
			<pubDate>Fri, 31 Jan 2020 11:56:50 +0000</pubDate>
			<guid>http://forum.alexanderklimov.ru/viewtopic.php?pid=1177#p1177</guid>
		</item>
		<item>
			<title><![CDATA[Re: Светофор]]></title>
			<link>http://forum.alexanderklimov.ru/viewtopic.php?pid=1170#p1170</link>
			<description><![CDATA[<p>Спасибо.<br />Ваши статьи помогают.</p><p>Так проще всего если у каждой заранее задать цвет кнопке</p><p> public void onClick(View view) {<br />&nbsp; &nbsp; &nbsp; &nbsp; Button myB = (Button) view;<br />&nbsp; &nbsp; &nbsp; &nbsp; basicView.setBackground(myB.getBackground());<br />&nbsp; &nbsp; &nbsp; &nbsp; colorDeskripton.setText(myB.getText());<br />&nbsp; &nbsp; }</p>]]></description>
			<author><![CDATA[null@example.com (dmitrybarynov)]]></author>
			<pubDate>Fri, 27 Dec 2019 19:43:27 +0000</pubDate>
			<guid>http://forum.alexanderklimov.ru/viewtopic.php?pid=1170#p1170</guid>
		</item>
		<item>
			<title><![CDATA[Re: Светофор]]></title>
			<link>http://forum.alexanderklimov.ru/viewtopic.php?pid=1082#p1082</link>
			<description><![CDATA[<div class="quotebox"><cite>ellenripley4 wrote:</cite><blockquote><p>Почему в режиме разметки, когда я ставлю фон своему ConstrainLayout через свойство Background, у меня меняется фон и у всех кнопок тоже?</p></blockquote></div><p>У кнопок проверьте Background - не наследуется ли от разметки?</p>]]></description>
			<author><![CDATA[null@example.com (NeferSky)]]></author>
			<pubDate>Thu, 29 Mar 2018 11:27:47 +0000</pubDate>
			<guid>http://forum.alexanderklimov.ru/viewtopic.php?pid=1082#p1082</guid>
		</item>
		<item>
			<title><![CDATA[Re: Светофор]]></title>
			<link>http://forum.alexanderklimov.ru/viewtopic.php?pid=1081#p1081</link>
			<description><![CDATA[<p>Почему в режиме разметки, когда я ставлю фон своему ConstrainLayout через свойство Background, у меня меняется фон и у всех кнопок тоже?</p>]]></description>
			<author><![CDATA[null@example.com (ellenripley4)]]></author>
			<pubDate>Thu, 29 Mar 2018 07:41:40 +0000</pubDate>
			<guid>http://forum.alexanderklimov.ru/viewtopic.php?pid=1081#p1081</guid>
		</item>
		<item>
			<title><![CDATA[Re: Светофор]]></title>
			<link>http://forum.alexanderklimov.ru/viewtopic.php?pid=1018#p1018</link>
			<description><![CDATA[<p>Вобщем после того как изменил в кнопках обработчик, перестало робить приложение, долго ломал голову что не так, а оказалось что создался файлик activity_main.xml (v21)&nbsp; в соседней папке дубль <a href="http://prntscr.com/hoo0zt">http://prntscr.com/hoo0zt</a><br />Вопрос зачем он создается и почему не видит изменение в родном файле? хотя при создании родного заполняется один в один.</p><p>Неужели при правке в дальнейшем надо искать все файлы дубли для других версий и обновлять код и вних тоже ?<br />Или есть какая то синхронизация ?</p>]]></description>
			<author><![CDATA[null@example.com (permsk)]]></author>
			<pubDate>Sun, 17 Dec 2017 16:07:01 +0000</pubDate>
			<guid>http://forum.alexanderklimov.ru/viewtopic.php?pid=1018#p1018</guid>
		</item>
		<item>
			<title><![CDATA[Re: Светофор]]></title>
			<link>http://forum.alexanderklimov.ru/viewtopic.php?pid=932#p932</link>
			<description><![CDATA[<p>Спасибо, разобрался.</p>]]></description>
			<author><![CDATA[null@example.com (Across)]]></author>
			<pubDate>Tue, 10 Oct 2017 03:30:25 +0000</pubDate>
			<guid>http://forum.alexanderklimov.ru/viewtopic.php?pid=932#p932</guid>
		</item>
		<item>
			<title><![CDATA[Re: Светофор]]></title>
			<link>http://forum.alexanderklimov.ru/viewtopic.php?pid=931#p931</link>
			<description><![CDATA[<div class="quotebox"><cite>Across wrote:</cite><blockquote><p>Не хочет компилировать ни мой код ни код с урока (полностью копировал). Выдет вот такую ошибку.</p><p>Error:(21, 65) error: cannot find symbol variable constraintLayout<br />Error:(21, 65) error: cannot find symbol variable constraintLayout<br />Error:Execution failed for task &#039;:app:compileDebugJavaWithJavac&#039;.<br />&gt; Compilation failed; see the compiler error output for details.</p><p>В этой части кода:<br />mConstraintLayout = (ConstraintLayout) findViewById(R.id.constraintLayout); &lt;------- в студии последнее слово подчеркнуто красным<br />mInfoTextView = (TextView) findViewById(R.id.textViewInfo);&nbsp; &lt;-------- в студии последнее слово подчеркнуто красным</p><p>В чем может быть проблема?<br />За ранее благодарен</p></blockquote></div><p>В разметке смотрите, как именован layout и textView, по-видимому, Вы их там не переименовали.</p>]]></description>
			<author><![CDATA[null@example.com (NeferSky)]]></author>
			<pubDate>Mon, 09 Oct 2017 04:46:12 +0000</pubDate>
			<guid>http://forum.alexanderklimov.ru/viewtopic.php?pid=931#p931</guid>
		</item>
		<item>
			<title><![CDATA[Re: Светофор]]></title>
			<link>http://forum.alexanderklimov.ru/viewtopic.php?pid=929#p929</link>
			<description><![CDATA[<p>Не хочет компилировать ни мой код ни код с урока (полностью копировал). Выдет вот такую ошибку.</p><p>Error:(21, 65) error: cannot find symbol variable constraintLayout<br />Error:(21, 65) error: cannot find symbol variable constraintLayout<br />Error:Execution failed for task &#039;:app:compileDebugJavaWithJavac&#039;.<br />&gt; Compilation failed; see the compiler error output for details.</p><div class="codebox"><pre><code>package across.helloworld;

import android.os.Bundle;
import android.support.constraint.ConstraintLayout;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {

    private ConstraintLayout mConstraintLayout;
    private TextView mInfoTextView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        mConstraintLayout = (ConstraintLayout) findViewById(R.id.constraintLayout);
        mInfoTextView = (TextView) findViewById(R.id.textViewInfo);

    }

    public void onRedButtonClick(View view) {
        mInfoTextView.setText(R.string.red);
        mConstraintLayout.setBackgroundColor(ContextCompat.getColor(this, R.color.redColor));
}

    public void onYelloButtonClick(View view) {
        mInfoTextView.setText(R.string.red);
        mConstraintLayout.setBackgroundColor(ContextCompat.getColor(this, R.color.yellowColor));
    }

    public void onGreenButtonClick(View view) {
        mInfoTextView.setText(R.string.red);
        mConstraintLayout.setBackgroundColor(ContextCompat.getColor(this, R.color.greenColor));
    }
}</code></pre></div><p>В этой части кода:<br />mConstraintLayout = (ConstraintLayout) findViewById(R.id.constraintLayout); &lt;------- в студии последнее слово подчеркнуто красным<br />mInfoTextView = (TextView) findViewById(R.id.textViewInfo);&nbsp; &lt;-------- в студии последнее слово подчеркнуто красным</p><p>В чем может быть проблема?<br />Заранее благодарен</p>]]></description>
			<author><![CDATA[null@example.com (Across)]]></author>
			<pubDate>Mon, 09 Oct 2017 01:44:28 +0000</pubDate>
			<guid>http://forum.alexanderklimov.ru/viewtopic.php?pid=929#p929</guid>
		</item>
		<item>
			<title><![CDATA[Re: Светофор]]></title>
			<link>http://forum.alexanderklimov.ru/viewtopic.php?pid=887#p887</link>
			<description><![CDATA[<div class="quotebox"><cite>NeferSky wrote:</cite><blockquote><p>Хороший подход, что Вас смущает?))</p></blockquote></div><p>ну главное, что прием работает и задание из урока выполнил ПО СВОЕМУ,<br />но все таки если событий будет много то этот подход не подойдет. лучше будет как в примере из статьи &quot;кнопка&quot;, которую кстати прочитал после выполнения задания ))</p>]]></description>
			<author><![CDATA[null@example.com (ramazan0504)]]></author>
			<pubDate>Mon, 28 Aug 2017 14:42:14 +0000</pubDate>
			<guid>http://forum.alexanderklimov.ru/viewtopic.php?pid=887#p887</guid>
		</item>
		<item>
			<title><![CDATA[Re: Светофор]]></title>
			<link>http://forum.alexanderklimov.ru/viewtopic.php?pid=883#p883</link>
			<description><![CDATA[<div class="quotebox"><cite>ramazan0504 wrote:</cite><blockquote><p>а я сделал так и тоже работает, сколько ударов по голове я заслуживаю за такой подход?</p></blockquote></div><p>Хороший подход, что Вас смущает?))</p>]]></description>
			<author><![CDATA[null@example.com (NeferSky)]]></author>
			<pubDate>Mon, 28 Aug 2017 11:18:54 +0000</pubDate>
			<guid>http://forum.alexanderklimov.ru/viewtopic.php?pid=883#p883</guid>
		</item>
		<item>
			<title><![CDATA[Re: Светофор]]></title>
			<link>http://forum.alexanderklimov.ru/viewtopic.php?pid=882#p882</link>
			<description><![CDATA[<p>а я сделал так и тоже работает, сколько ударов по голове я заслуживаю за такой подход?</p><p>public class VoronActivity extends AppCompatActivity {<br />&nbsp; &nbsp; private ConstraintLayout layout;<br />&nbsp; &nbsp; private TextView textView;<br />&nbsp; &nbsp; private Button redButton;<br />&nbsp; &nbsp; private Button greenButton;<br />&nbsp; &nbsp; private Button yellowButton;</p><p>&nbsp; &nbsp; @Override<br />&nbsp; &nbsp; protected void onCreate(Bundle savedInstanceState) {<br />&nbsp; &nbsp; &nbsp; &nbsp; super.onCreate(savedInstanceState);<br />&nbsp; &nbsp; &nbsp; &nbsp; setContentView(R.layout.activity_voron);<br />&nbsp; &nbsp; &nbsp; &nbsp; layout = (ConstraintLayout)findViewById(R.id.layout);<br />&nbsp; &nbsp; &nbsp; &nbsp; textView = (TextView)findViewById(R.id.textView);\</p><p>&nbsp; &nbsp; &nbsp; &nbsp; redButton = (Button)findViewById(R.id.button_red);<br />&nbsp; &nbsp; &nbsp; &nbsp; greenButton = (Button)findViewById(R.id.button_green);<br />&nbsp; &nbsp; &nbsp; &nbsp; yellowButton = (Button)findViewById(R.id.button_yellow);</p><p>&nbsp; &nbsp; &nbsp; &nbsp; onClick(redButton,R.string.red, R.color.colorRed);<br />&nbsp; &nbsp; &nbsp; &nbsp; onClick(greenButton,R.string.green, R.color.colorGreen);<br />&nbsp; &nbsp; &nbsp; &nbsp; onClick(yellowButton,R.string.yellow, R.color.colorYellow);</p><p>&nbsp; &nbsp; }</p><p>&nbsp; &nbsp; public void onClick(Button button, final int resString, final int color) {<br />&nbsp; &nbsp; &nbsp; &nbsp; button.setOnClickListener(new View.OnClickListener() {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; @Override<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public void onClick(View view) {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; textView.setText(resString);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; layout.setBackgroundColor(ContextCompat.getColor(VoronActivity.this, color));<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />&nbsp; &nbsp; &nbsp; &nbsp; });<br />&nbsp; &nbsp; }<br />}</p>]]></description>
			<author><![CDATA[null@example.com (ramazan0504)]]></author>
			<pubDate>Mon, 28 Aug 2017 10:44:44 +0000</pubDate>
			<guid>http://forum.alexanderklimov.ru/viewtopic.php?pid=882#p882</guid>
		</item>
		<item>
			<title><![CDATA[Re: Светофор]]></title>
			<link>http://forum.alexanderklimov.ru/viewtopic.php?pid=836#p836</link>
			<description><![CDATA[<p>Точно, благодарю! <br />Я не специально редактировал, случайно как-то получилось, сам не понял как.</p>]]></description>
			<author><![CDATA[null@example.com (frods)]]></author>
			<pubDate>Thu, 01 Jun 2017 17:20:47 +0000</pubDate>
			<guid>http://forum.alexanderklimov.ru/viewtopic.php?pid=836#p836</guid>
		</item>
	</channel>
</rss>
