我试图更新所有库,但我仍然有错误.我能够在模拟器上运行应用程序,但是当我导出APK并在真正的Android设备上运行时,该应用程序无法运行.
MinSdkVersion是8,targetSdkVersion是19.请帮忙!!!
menu.xml文件
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:example="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_showTC"
android:orderInCategory="100"
android:showAsAction="never"
android:title="Terms and Conditions"/>
<item android:id="@+id/action_search"
android:title="Search"
android:orderInCategory="100"
example:showAsAction="ifRoom|collapseActionView"
example:actionViewClass="android.support.v7.widget.SearchView"/>
</menu>
Run Code Online (Sandbox Code Playgroud)
搜索查看
@Override
public boolean onOptionsItemSelected(MenuItem item){
if(item.getItemId() == R.id.action_showTC){
startActivity(new Intent(MainActivity.this, T_C.class));
return true;
}else{
return super.onOptionsItemSelected(item);
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.main, menu);
SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
SupportMenuItem searchMenuItem = ((SupportMenuItem) menu.findItem(R.id.action_search));
SearchView searchView = (SearchView) searchMenuItem.getActionView();
searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
return super.onCreateOptionsMenu(menu);
}
Run Code Online (Sandbox Code Playgroud)
表现
<activity android:name="com.agehk.queue.SearchResultsActivity"
android:parentActivityName="com.agehk.queue.MainActivity" >
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
</intent-filter> …Run Code Online (Sandbox Code Playgroud) 我想在Android 2.3中使用Action bar和Fragment,但是有一个错误
Type mismatch: cannot convert from android.app.ActionBar to android.support.v7.app.ActionBar
Run Code Online (Sandbox Code Playgroud)
在这一排
final ActionBar bar = getActionBar();
Run Code Online (Sandbox Code Playgroud)
我已经导入了android.support.v4和v7.
package com.hmkcode.android;
import android.support.v7.app.ActionBar;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v4.view.ViewPager;
import android.view.Menu;
import android.view.MenuItem;
public class MainActivity extends FragmentActivity {
private ViewPager pager;
private TabsAdapter mTabsAdapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
pager = new ViewPager(this);
pager.setId(R.id.pager);
setContentView(pager);
final ActionBar bar = getActionBar();
bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
mTabsAdapter = new TabsAdapter(this, pager);
mTabsAdapter.addTab(bar.newTab().setText("List Fragment 1"), List_View.class, null);
mTabsAdapter.addTab(bar.newTab().setText("List Fragment 2"), List_View.class, null);
mTabsAdapter.addTab(bar.newTab().setText("List …Run Code Online (Sandbox Code Playgroud) 我想在Windows 7 Sp1中使用PowerShell 2.0重命名计算机,但它出错了.
PS C:\Windows\system32> Rename-Computer -NewName PC02
The term 'Rename-Computer' is not recognized as the name of a cmdlet, function, script f
ile, or operable program. Check the spelling of the name, or if a path was included, ver
ify that the path is correct and try again.
At line:1 char:16
+ Rename-Computer <<<< -NewName PC02
+ CategoryInfo : ObjectNotFound: (Rename-Computer:String) [], CommandNotFo
undException
+ FullyQualifiedErrorId : CommandNotFoundException
Run Code Online (Sandbox Code Playgroud)