2016-04-13 14 views
1

私のコードに問題があります... 前に、それがうまくいった後、レイアウトにシンプルな線を追加しました。私は私の学校のライブラリーのためのアプリをする方法を自分で学習しようとしているので、私はプロではありません。 ありがとうございました。メソッドとLinearLayoutを解決できません

ここでエラーが

`@Override 保護され、ボイドのonCreate(バンドルsavedInstanceState){ super.onCreate(savedInstanceState) "Rを解決できません" です。 setContentView(R.layout.activity_main);

majorOb = (Spinner) findViewById(R.id.spinnerMaj); 
    yearOb = (Spinner) findViewById(R.id.spinnerYear); 
    semesterOb = (Spinner) findViewById(R.id.spinnerSem); 
    classOB = (Spinner) findViewByID(R.id.spinnerClass); 
    button1 = (Button) findViewById(R.id.button1); 
    tv1 = (TextView) findViewById(R.id.textview1); 
    Resources res = getResources(); 
    array1 = res.getStringArray(R.array.Books);` 

ここでエラーです:要素のLinearLayoutは、必要な属性を持っているdoesntの:layout_height ADN layout_width

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
tools:context="com.example.marcosbiblio.projetofinal.MainActivity"> 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:paddingBottom="@dimen/activity_vertical_margin" 
android:paddingLeft="@dimen/activity_horizontal_margin" 
android:paddingRight="@dimen/activity_horizontal_margin" 
android:paddingTop="@dimen/activity_vertical_margin"> 
+1

をお試しくださいビルドオプション –

+1

から[Rは解決できません - Androidエラー](http://stackoverflow.com/questions/885009/r-cannot-be-resolved-android-error) – Rovanion

答えて

0

は、 "Rを解決できません" 清潔でプロジェクトを再構築については、この

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
tools:context="com.example.marcosbiblio.projetofinal.MainActivity" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:paddingBottom="@dimen/activity_vertical_margin" 
android:paddingLeft="@dimen/activity_horizontal_margin" 
android:paddingRight="@dimen/activity_horizontal_margin" 
android:paddingTop="@dimen/activity_vertical_margin"></LinearLayout> 
関連する問題