teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

8

文章を追加しました。

2017/11/09 02:58

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -1,5 +1,6 @@
1
1
  お世話になります。
2
2
  8行目・10行目の drawable.color_linkのcolor_linkが赤字になり、setBackgroundDrawable()とgetDrawable()に取り消し線が表示されます。
3
+ もしかして、color_linkの方に問題があるのかも。。。?
3
4
 
4
5
  あと、33行目の R.drawable.set_iconも赤字になります。
5
6
  いろいろと例えば下のようなものなどを調べて試してみましたが、駄目でした。https://teratail.com/questions/11124
@@ -63,6 +64,33 @@
63
64
  return ret;
64
65
  }
65
66
  ```
67
+ color_link
68
+ ```ここに言語を入力
69
+ <?xml version="1.0" encoding="utf-8" ?>
66
70
 
71
+ <selector xmlns:android="http://schemas.android.com/apk/res/android">
72
+ <item android:state_pressed="true">
73
+ <shape android:shape="rectangle">
74
+ <gradient android:startColor="#660000"
75
+ android:endColor="#CC0066"
76
+ android:angle="90" />
77
+ <corners android:bottomRightRadius="3dp"
78
+ android:bottomLeftRadius="3dp" android:topLeftRadius="3dp"
79
+ android:topRightRadius="3dp" />
80
+ <stroke android:width="2px" android:color="#666666" />
81
+ </shape>
82
+ </item>
83
+ <item android:state_pressed="false">
84
+ <shape android:shape="rectangle">
85
+ <gradient android:startColor="#111111" android:endColor="#333333"
86
+ android:angle="90" />
87
+ <corners android:bottomRightRadius="3dp"
88
+ android:bottomLeftRadius="3dp" android:topLeftRadius="3dp"
89
+ android:topRightRadius="3dp" />
90
+ <stroke android:width="2px" android:color="#666666" />
91
+ </shape>
92
+ </item>
93
+ </selector>
94
+ ```
67
95
  >あと、33行目の R.drawable.set_iconも赤字になります。
68
96
  drawableの部分をmipmapに変えたらエラーが消えました。

7

文章を変えました。あとタイトルも変えました。

2017/11/09 02:58

投稿

退会済みユーザー
title CHANGED
@@ -1,1 +1,1 @@
1
- drawableアクセスしたい。
1
+ ボタンsetBackgroundDrawaableとgetDrawableの代わりになるように変更したい。
body CHANGED
@@ -1,5 +1,6 @@
1
1
  お世話になります。
2
2
  8行目・10行目の drawable.color_linkのcolor_linkが赤字になり、setBackgroundDrawable()とgetDrawable()に取り消し線が表示されます。
3
+
3
4
  あと、33行目の R.drawable.set_iconも赤字になります。
4
5
  いろいろと例えば下のようなものなどを調べて試してみましたが、駄目でした。https://teratail.com/questions/11124
5
6
  試しに、デバッグをしてみたら
@@ -26,9 +27,9 @@
26
27
 
27
28
  Button saveBtn = (Button) findViewById(R.id.saveButton);
28
29
  Button sendBtn = (Button) findViewById(R.id.sendButton);
29
- saveBtn.setBackgroundDrawable(getResources().getDrawable(
30
+ ココ→saveBtn.setBackgroundDrawable(getResources().getDrawable(
30
31
  drawable.color_link));
31
- sendBtn.setBackgroundDrawable(getResources().getDrawable(
32
+ ココ→sendBtn.setBackgroundDrawable(getResources().getDrawable(
32
33
  drawable.color_link));
33
34
  saveBtn.setOnClickListener(new ButtonClickListener());
34
35
  sendBtn.setOnClickListener(new ButtonClickListener());

6

解決策の一種

2017/11/09 02:36

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -61,4 +61,7 @@
61
61
  android.R.drawable.ic_menu_help);
62
62
  return ret;
63
63
  }
64
- ```
64
+ ```
65
+
66
+ >あと、33行目の R.drawable.set_iconも赤字になります。
67
+ drawableの部分をmipmapに変えたらエラーが消えました。

5

追加修正をしました。

2017/11/08 05:57

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -3,9 +3,18 @@
3
3
  あと、33行目の R.drawable.set_iconも赤字になります。
4
4
  いろいろと例えば下のようなものなどを調べて試してみましたが、駄目でした。https://teratail.com/questions/11124
5
5
  試しに、デバッグをしてみたら
6
+ Error:(111, 45) エラー: シンボルを見つけられません
7
+ シンボル: 変数 drawable
8
+ 場所: クラス MainActivity
6
9
  エラー: シンボルを見つけられません
7
10
  シンボル: 変数 drawable
8
11
  場所: クラス MainActivity
12
+ エラー: シンボルを見つけられません
13
+ シンボル: 変数 set_icon
14
+ 場所: クラス drawable
15
+ エラー: シンボルを見つけられません
16
+ シンボル: 変数 drawable
17
+ 場所: クラス MainActivity
9
18
  Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
10
19
  Compilation failed; see the compiler error output for details.
11
20
  と出ます。

4

誤字修正

2017/11/08 05:18

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -7,7 +7,7 @@
7
7
  シンボル: 変数 drawable
8
8
  場所: クラス MainActivity
9
9
  Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
10
- > Compilation failed; see the compiler error output for details.
10
+ Compilation failed; see the compiler error output for details.
11
11
  と出ます。
12
12
 
13
13
  ```ここに言語を入力

3

誤字の修正をしました。

2017/11/08 05:16

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -6,11 +6,10 @@
6
6
  エラー: シンボルを見つけられません
7
7
  シンボル: 変数 drawable
8
8
  場所: クラス MainActivity
9
- と出ます。
10
9
  Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
11
10
  > Compilation failed; see the compiler error output for details.
11
+ と出ます。
12
12
 
13
-
14
13
  ```ここに言語を入力
15
14
  public void onCreate(Bundle savedInstanceState) {
16
15
  super.onCreate(savedInstanceState);

2

文法の追加をしました。

2017/11/08 05:15

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -7,6 +7,8 @@
7
7
  シンボル: 変数 drawable
8
8
  場所: クラス MainActivity
9
9
  と出ます。
10
+ Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
11
+ > Compilation failed; see the compiler error output for details.
10
12
 
11
13
 
12
14
  ```ここに言語を入力

1

文法修正しました。

2017/11/08 05:15

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -1,3 +1,4 @@
1
+ お世話になります。
1
2
  8行目・10行目の drawable.color_linkのcolor_linkが赤字になり、setBackgroundDrawable()とgetDrawable()に取り消し線が表示されます。
2
3
  あと、33行目の R.drawable.set_iconも赤字になります。
3
4
  いろいろと例えば下のようなものなどを調べて試してみましたが、駄目でした。https://teratail.com/questions/11124