這個問題的問題好像它已經回答了,但沒有更新,我的工作在Android工作室1.5.1.0,我在activity_main.xml中得到一個錯誤,並在MainActivity.java。在製作我的應用程序時,我沒有問題,直到我試圖運行它。採用Android 1.5.1影城
這是來到了,當我試圖運行它
Error:(13, 24) No resource found that matches the given name (at 'theme' with value '@style/AppTheme.AppBarOverlay').
Error:(20, 29) No resource found that matches the given name (at 'popupTheme' with value '@style/AppTheme.PopupOverlay').
Error:Execution failed for task ':app:processDebugResources.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Android\sdk\build-tools\23.0.2\aapt.exe'' finished with non-zero exit value 1
在我activity_main.xml中
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" /> This is in red
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_main" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
android:src="@android:drawable/ic_dialog_email" />
,並在我的mainactivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final EditText tickets = (EditText)findViewById(R.id.txtTickets);
final Spinner group = (Spinner)findViewById(R.id.txtGroup);
Button cost = (Button)findViewById(R.id.btncost);
cost.setOnClickListener(new View.OnClickListener() {
final TextView result = ((TextView)findViewById(R.id.txtResult);
@Override
public void onClick(View v) {
numberOfTickets = Integer.parseInt(tickets.getText().toString());
totalCost = costPerTickets * numberOfTickets;
DecimalFormat currency = new DecimalFormat("$###,###.##");
groupchoice = group.getSelectedItem().toString();
result.setText("Cost for " + groupchoice + " is " + currency.format(totalCost));
}
});
}
所有(R.)是紅
'import com.example.your_package_name.R;'並改變你的主題。並上傳你的build.gradle文件 –
我該怎麼做? –
在這裏更新你的構建gradle文件 –