请告诉我出错的地方.
我正在创建一个应用程序,其活动之一仅在横向模式下.所以我在AndroidManifest.xml文件中添加了以下内容
<activity android:name=".LandScapeImageActivity" android:screenOrientation="landscape"></activity>
Run Code Online (Sandbox Code Playgroud)
我创建了一个像这样的文件夹
/ RES /布局,土地
并在其中添加名为see_today_landscape_layout的布局.
在onCreate()我添加以下内容
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.see_today_landscape_layout);
....
}
Run Code Online (Sandbox Code Playgroud)
但是,当我运行我的应用程序时,我收到以下错误
02-06 13:46:14.358: E/AndroidRuntime(13286): FATAL EXCEPTION: main
02-06 13:46:14.358: E/AndroidRuntime(13286): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mid.kew.activities/com.mid.kew.activities.LandScapeImageActivity}: android.content.res.Resources$NotFoundException: Resource ID #0x7f03002b
02-06 13:46:14.358: E/AndroidRuntime(13286): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2787)
02-06 13:46:14.358: E/AndroidRuntime(13286): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2803)
02-06 13:46:14.358: E/AndroidRuntime(13286): at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:4066)
02-06 13:46:14.358: E/AndroidRuntime(13286): at android.app.ActivityThread.access$2400(ActivityThread.java:135)
02-06 13:46:14.358: E/AndroidRuntime(13286): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2140)
02-06 13:46:14.358: E/AndroidRuntime(13286): at android.os.Handler.dispatchMessage(Handler.java:99)
02-06 13:46:14.358: E/AndroidRuntime(13286): at android.os.Looper.loop(Looper.java:144)
02-06 …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用为Android提供的最新Map API 2.0.我正在使用支持库,因为我想支持Android 2.2.以下是我的代码:
主要活动类
public class MainActivity extends FragmentActivity {
public FragmentManager fManager ;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
fManager = getSupportFragmentManager();
Button showMapButton = (Button) findViewById(R.id.showMapButton);
showMapButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
loadMapFragment();
}
});
}
private void loadMapFragment() {
MapPageFragment plotterFragment = new MapPageFragment();
FragmentTransaction ft = fManager.beginTransaction();
ft.replace(R.id.allFragmentsFrameLayout, plotterFragment);
ft.addToBackStack(null);
ft.commit();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
}
Run Code Online (Sandbox Code Playgroud)
主活动布局文件
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" …Run Code Online (Sandbox Code Playgroud) maps android google-maps-api-2 android-fragments supportmapfragment
我是IOS的新手.我正在使用故事板功能来创建应用程序
这就是我想要的.我有两个视图控制器,比如oneViewController和twoViewController
我在oneViewController上有一个按钮.我按下+从一个ViewController拖动按钮到两个ViewController并从Segue中选择推送.
我在iOS 5.0上编译了应用程序并运行它,它无法正常工作.我把推送改为模型并且工作正常.我错过了什么吗?
我已经设法在我的活动中更改了片段的方向.旋转设备时,方向会发生变化.
现在,当我点击片段中的按钮时,我想要相同的功能.即当我点击肖像布局和签证上的按钮时,我想从纵向模式更改为LandScape模式.
我用了
getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
Run Code Online (Sandbox Code Playgroud)
和
getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
Run Code Online (Sandbox Code Playgroud)
分别.
但这使自动旋转功能停止工作.我该如何解决这个问题?
android screen-orientation orientation-changes android-fragments
我通过以下链接说明在卸载我的应用程序时将自动删除外部文件夹.
我使用以下代码来创建文件夹和文件:
private static String TEMP_FOLDER_PATH = Environment.getExternalStorageDirectory() + "/myAppFolder/";
Run Code Online (Sandbox Code Playgroud)
我的问题是当我卸载应用程序时,文件夹myAppFolder没有被删除.
我在哪里错了?
我是iOS开发的新手,我直接从IOS 5开始.我创建了一个故事板,其中包含一个tabview控制器作为其rootviewcontroller.我已经放了两个标签.
我想最初取消选择/取消选中所有标签.我该怎么做呢?我尝试了以下内容
UIView *view = [[UIView alloc]initWithNibName:@"view" bundle:[NSBundle mainBundle]];
[self.tabBarController setSelectedViewController:nil];
[self.tabBarController setSelectedViewController:view];
Run Code Online (Sandbox Code Playgroud)
我添加了标识符"view"的视图.
但这不起作用,它给出了错误:
unrecognized selector sent to instance
Run Code Online (Sandbox Code Playgroud)
我也试过以下
[self.tabBarController.tabBar setSelectedItem:nil];
Run Code Online (Sandbox Code Playgroud)
但它说
'NSInternalInconsistencyException',原因是:'不允许直接修改由标签栏控制器管理的标签栏.'
我已在第一个选项卡的控制器中尝试了此代码.我想这样做是因为我想在第一个标签视图的顶部放置一个默认视图,并在下面任何一个标签上单击使用后隐藏它.
我有以下布局
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="bottom"
android:background="@drawable/background_grey"
android:fillViewport="true"
android:focusable="true"
android:focusableInTouchMode="true"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<RelativeLayout
android:id="@+id/logo_layout"
android:layout_width="fill_parent"
android:layout_height="@dimen/layout_height"
android:layout_alignParentTop="true"
android:background="@drawable/logo_container" >
<!-- some layout components-->
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/logo_layout"
android:layout_margin="@dimen/default_margin" >
<!-- some layout components-->
<RelativeLayout
android:id="@+id/activation_code_entry_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/activation_body_second_paragraph"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"
android:background="@drawable/enter_passcode_background"
android:gravity="center_vertical" >
<!-- some layout components-->
<EditText
android:id="@+id/activationCode"
style="@style/FormField"
android:layout_alignParentRight="true"
android:layout_marginRight="@dimen/side_margin"
android:hint="@string/activation_enter_code"
android:inputType="number"
android:maxLength="10"/>
<!-- some layout components-->
</RelativeLayout>
<!-- some layout components-->
</RelativeLayout>
</RelativeLayout>
</ScrollView>
Run Code Online (Sandbox Code Playgroud)
在Application Manifest文件中,我将活动设置为
<activity
android:name=".activities.MyActivity"
android:enabled="true" …Run Code Online (Sandbox Code Playgroud) 我尝试了在网站和本网站上给出的所有可能的选项,但没有一个可行.
我正进入(状态:
启动错误:无法连接到远程VM.连接超时.
当我试图在我的移动设备上调试我的应用程序时.当我正常运行时,应用程序正常运行而没有任何问题
我现在已经使用了这些链接:
Eclipse问题 - 启动错误:无法连接到远程VM.连接超时
https://forums.oracle.com/forums/thread.jspa?threadID=653343
以上都不适用.
我看过这个链接,显示我如何限制下载到平板电脑,但我反过来看.
如何限制我的应用只能在手机上下载,而不能在平板电脑上下载?(这是客户的要求.)
以下代码对我不起作用.
finish();
overridePendingTransition(R.anim.slide_up,R.anim.slide_up);
startActivity(intent);
overridePendingTransition(R.anim.slide_up,R.anim.slide_up);
Run Code Online (Sandbox Code Playgroud)
而动画的XML是
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:fromXDelta="50%p" android:toXDelta="-50"
android:duration="@android:integer/config_mediumAnimTime"/>
<alpha android:fromAlpha="0.0" android:toAlpha="1.0"
android:duration="@android:integer/config_mediumAnimTime" />
</set>
Run Code Online (Sandbox Code Playgroud)
我搜索了网络,看到Stack Overflow中的所有线程,但无法修复此问题.