我正在使用Android Studio构建应用,但我无法显示ToolBar。 这是我的AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mcsolution.easymanagementandroid">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme" >
<activity
android:name="com.mcsolution.easymanagementandroid.main.MainActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.mcsolution.easymanagementandroid.main.nuovoOrdine"></activity>
<activity android:name="com.mcsolution.easymanagementandroid.ordine.creaOrdine"></activity>
<activity android:name="com.mcsolution.easymanagementandroid.ordine.mainOrdine"></activity>
<activity android:name="com.mcsolution.easymanagementandroid.ordine.viewOrdine"></activity>
<activity
android:name="com.mcsolution.easymanagementandroid.setting.setting"
android:label="@string/app_name"
android:windowSoftInputMode="stateVisible|adjustResize"
android:configChanges="orientation|screenSize"/>
<activity android:name="com.mcsolution.easymanagementandroid.articoli.viewArticoli"
android:windowSoftInputMode="stateVisible|adjustResize"
android:configChanges="orientation|screenSize"/>
<activity android:name="com.mcsolution.easymanagementandroid.clienti.mainClienti"
android:windowSoftInputMode="stateVisible|adjustResize"
android:configChanges="orientation|screenSize"/>
<activity android:name="com.mcsolution.easymanagementandroid.clienti.viewClienti"
android:windowSoftInputMode="stateVisible|adjustResize"
android:configChanges="orientation|screenSize"/>
<activity android:name="com.mcsolution.easymanagementandroid.clienti.infoCliente"
android:windowSoftInputMode="stateHidden|adjustResize"
android:configChanges="orientation|screenSize"/>
<activity android:name="com.mcsolution.easymanagementandroid.clienti.operazioniCliente"
android:windowSoftInputMode="stateHidden|adjustResize"
android:configChanges="orientation|screenSize"/>
<activity android:name="com.mcsolution.easymanagementandroid.clienti.operazioniClienteDettaglio"
android:windowSoftInputMode="stateHidden|adjustResize"
android:configChanges="orientation|screenSize"/>
</application>
</manifest>
如何显示工具栏?
EDIT 这是活动主要
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:background="@color/cardview_dark_background">
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
card_view:cardBackgroundColor="@color/cardview_light_background">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/articoli"
android:onClick="visualizzaArticoli"
android:background="@null"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Articoli"
android:layout_gravity="center_vertical"
android:layout_marginLeft="50dp"/>
</LinearLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
card_view:cardBackgroundColor="@color/cardview_light_background">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/order"
android:onClick="creaOrdine"
android:background="@null"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/ordini"
android:layout_gravity="center_vertical"
android:layout_marginLeft="50dp"/>
</LinearLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
card_view:cardBackgroundColor="@color/cardview_light_background">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/customer"
android:onClick="viewClienti"
android:background="@null"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/cliente"
android:layout_gravity="center_vertical"
android:layout_marginLeft="50dp"/>
</LinearLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
card_view:cardBackgroundColor="@color/cardview_light_background">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/sincronizza"
android:onClick="allineaDatase"
android:background="@null"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/allinea_database"
android:layout_gravity="center_vertical"
android:layout_marginLeft="50dp"/>
</LinearLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
card_view:cardBackgroundColor="@color/cardview_light_background">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/setting"
android:onClick="setting"
android:background="@null"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/impostazioni"
android:layout_gravity="center_vertical"
android:layout_marginLeft="50dp"/>
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
package com.mcsolution.easymanagementandroid.main;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.widget.Toast;
import com.mcsolution.easymanagementandroid.R;
import com.mcsolution.easymanagementandroid.beans.Program;
import com.mcsolution.easymanagementandroid.connection.MyDatabase;
import com.mcsolution.easymanagementandroid.utility.SyncDati;
public class MainActivity extends Activity {
public MyDatabase db;
public ProgressDialog dialog;
public String url="";
private static final Intent SCAN_INTENT = new Intent("com.google.zxing.client.android.SCAN");
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//RelativeLayout layout = (RelativeLayout)findViewById(R.id.root);
// layout.setBackgroundColor(getResources().getColor(Color.BLUE));
PackageManager packageManager = this.getPackageManager();
@SuppressWarnings("unused")
ResolveInfo resolveInfo = packageManager.resolveActivity(SCAN_INTENT, PackageManager.GET_RESOLVED_FILTER);
// if(resolveInfo==null) {
// ((Button)this.findViewById(R.id.scanButton)).setEnabled(false);
// ((TextView)this.findViewById(R.id.scanResult)).setText("Non hai installato nessuna applicazione per effettuare lo scan!!!\nScaricala qui: http://www.appbrain.com/app/com.google.zxing.client.android");
// }
}
public void onScan(View view) {
startActivityForResult(SCAN_INTENT, 0);
}
private void apriConnessioneDB(){
db=new MyDatabase(getApplicationContext());
db.open(); //apriamo il db
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
public void visualizzaArticoli(View view){
Intent intent = new Intent(this, com.mcsolution.easymanagementandroid.articoli.viewArticoli.class);
startActivity(intent);
}
public void viewClienti(View view){
Intent intent = new Intent(this, com.mcsolution.easymanagementandroid.clienti.mainClienti.class);
startActivity(intent);
}
public void creaOrdine(View view){
Intent intent = new Intent(this, com.mcsolution.easymanagementandroid.ordine.mainOrdine.class);
startActivity(intent);
}
public void setting(View view){
Intent intent = new Intent(this, com.mcsolution.easymanagementandroid.setting.setting.class);
startActivity(intent);
}
public void allineaDatase(View view){
try{
}catch(Exception e){
e.printStackTrace();
Toast.makeText(this, e.getMessage(),
Toast.LENGTH_LONG).show();
}
}
}
答案 0 :(得分:3)
\D
答案 1 :(得分:0)
可能for rows in range(1, 11):
print('{:>2d}'.format(rows), 10 * '* ')
1 * * * * * * * * * *
2 * * * * * * * * * *
3 * * * * * * * * * *
4 * * * * * * * * * *
5 * * * * * * * * * *
6 * * * * * * * * * *
7 * * * * * * * * * *
8 * * * * * * * * * *
9 * * * * * * * * * *
10 * * * * * * * * * *
AppTheme
styles.xml
Theme
NoActionbar
将其设为
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>