質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Android

Androidは、Google社が開発したスマートフォンやタブレットなど携帯端末向けのプラットフォームです。 カーネル・ミドルウェア・ユーザーインターフェイス・ウェブブラウザ・電話帳などのアプリケーションやソフトウェアをひとつにまとめて構成。 カーネル・ライブラリ・ランタイムはほとんどがC言語/C++、アプリケーションなどはJavaSEのサブセットとAndroid環境で書かれています。

Eclipse

Eclipseは、IBM社で開発された統合開発環境のひとつです。2001年11月にオープンソース化されました。 たくさんのプラグインがあり自由に機能を追加をすることができるため、開発ツールにおける共通プラットフォームとして位置づけられています。 Eclipse自体は、Javaで実装されています。

Q&A

解決済

2回答

9057閲覧

スマホアプリの最初の一歩で躓いています

naia

総合スコア20

Android

Androidは、Google社が開発したスマートフォンやタブレットなど携帯端末向けのプラットフォームです。 カーネル・ミドルウェア・ユーザーインターフェイス・ウェブブラウザ・電話帳などのアプリケーションやソフトウェアをひとつにまとめて構成。 カーネル・ライブラリ・ランタイムはほとんどがC言語/C++、アプリケーションなどはJavaSEのサブセットとAndroid環境で書かれています。

Eclipse

Eclipseは、IBM社で開発された統合開発環境のひとつです。2001年11月にオープンソース化されました。 たくさんのプラグインがあり自由に機能を追加をすることができるため、開発ツールにおける共通プラットフォームとして位置づけられています。 Eclipse自体は、Javaで実装されています。

0グッド

1クリップ

投稿2015/01/03 05:29

現在Androidの入門書を読み進めているのですが詰まったので質問させて下さい
最初にViewSampleプロジェクトを作り、res/layoutディレクトリ内のviewsample.xmlに下記のコードを書きましたところ、9行目 xmlns:android="http://schemas.android.com/apk/res/android"
で、Unexpected namespace prefix "xmlns" found for tag LinearLayoutというエラーが出てしまいます。
何度も本と照らし合わせているのですがコードの間違いではなさそうです
それと、viewsample.xml以外は弄っていないのですが、src/exsample.android.viewsampleディレクトリ内のViewSample,javaにも赤xのエラー
Rを変数に解決できませんというエラーがでてしまいます
解決方法はありますでしょうか?

lang

1<!-- 画面全体のスクロールバーの追加 --> 2<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 3 android:orientation="vertical" 4 android:layout_width="fill_parent" 5 android:layout_height="fill_parent"> 6 <!-- レイアウトの定義 --> 7 <LinearLayout 8 xmlns:android="http://schemas.android.com/apk/res/android" 9 android:orientation="vertical"> 10 android:layout_width="fill_parent" 11 android:layout_height="wrap_content"> 12 13 <!-- TextViewの定義 --> 14 <TextView 15 android:layout_width="fill_parent" 16 android:layout_height="wrap_content" 17 android:layout_marginTop="5dp" 18 android:layout_marginBottom="5dp" 19 android:text="@string/textviewsample1" /> 20 21 <!-- テキストボックスの定義 --> 22 <CheckBox android:id="@+id/edittext" 23 android:layout_width="fill_parent" 24 android:layout_height="wrap_content" /> 25 26 <!-- CheckBoxの定義 --> 27 <CheckBox android:id="@+id/checkbox1" 28 android:paddingBottom="24sp" 29 android:paddingTop="24sp" 30 android:layout_width="wrap_content" 31 android:layout_height="wrap_content" 32 android:text="@string/checkboxsample2" /> 33 34 <CheckBox android:id="@+id/checkbox2" 35 android:layout_width="wrap_content" 36 android:layout_height="wrap_content" 37 android:text="@string/checkboxsample2" /> 38 39 <!-- RadioButtonの定義 --> 40 <RadioGroop 41 android:layout_width="fill_parent" 42 android:layout_height="wrap_content" 43 android:orientation="vertical"> 44 45 <RadioButton android:id="@+id/radiobutton1" 46 android:layout_width="wrap_content" 47 android:layout_height="wrap_content" 48 android:text="@string/radiobuttonsample1" /> 49 50 <RadioButton android:id="@+id/radiobutton2" 51 android:layout_width="wrap_content" 52 android:height="wrap_content" 53 android:text="@string/radiobuttonsample2" /> 54 55</RadioGroop> 56 57 <!-- Spinnerの定義 --> 58 <Spinner android:id="@+id/spinner1" 59 android:layout_width="fill_parent" 60 android:layout_height="wrap_content" 61 android:entries="@array/list_name" 62 android:drawSelectorOnTop="true" /> 63 64 <!-- ListViewの定義 --> 65 <ListView android:id="@+id/listView1" 66 android:paddingBottom="24sp" 67 android:paddingTop="24sp" 68 android:layout_width="fill_parent" 69 android:layout_height="250dp" 70 android:entries="@array/list_name" /> 71 72 <!-- ボタンの定義 --> 73 <Button android:id="@+id/button1" 74 android:layout_width="wrap_content" 75 android:layout_height="wrap_content" 76 android:text="@string/buttonsample1" /> 77 78</LinearLayout> 79</ScrollView> 80コード

どうぞよろしくお願いします

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答2

0

以下の箇所で、タグが閉じられているためだと思います。
修正するとどうなりますでしょうか?

lang

1<!-- 画面全体のスクロールバーの追加 --> 2<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 3 android:orientation="vertical" 4 android:layout_width="fill_parent" 5 android:layout_height="fill_parent"> 6 <!-- レイアウトの定義 --> 7 <LinearLayout 8 xmlns:android="http://schemas.android.com/apk/res/android" 9 android:orientation="vertical"> <!-- ← ここです --> 10 android:layout_width="fill_parent" 11 android:layout_height="wrap_content">

投稿2015/01/03 05:53

ryunix

総合スコア1656

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

0

自己解決

lang

1 <LinearLayout 2 xmlns:android="http://schemas.android.com/apk/res/android" 3 android:orientation="vertical" 4 android:layout_width="fill_parent" 5 android:layout_height="wrap_content">

レスありがとうございます。
ご指摘頂いた箇所を修正しましたが
xmlns:android="http://schemas.android.com/apk/res/android"
この部分に赤い波線が現れ、Unexpected namespace prefix "xmlns" found for tag LinearLayout新たにエラーが発生しました
_xmlnsとは何なのか、どう修正すればいいか見当もつかない状態です…

投稿2015/01/03 07:59

naia

総合スコア20

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

argius

2015/01/03 08:11

その行を消してみてください。
swordone

2015/01/06 05:34

xmlnsとは、「XMLの名前空間」のことです。 このページに軽く説明してあるので見てみるといいと思います。 http://www.javadrive.jp/android/activity/index6.html ここで出ているエラーですが、このLinearLayoutの親のビューである ScrollViewにおいてすでにxmlns:androidを宣言しているにもかかわらず、 また宣言しているためのエラーと思われます。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問