我写了这句话:
String Mess = R.string.mess_1 ;
Run Code Online (Sandbox Code Playgroud)
获取字符串值,但它不是返回字符串,而是给我类型为整数的id.我怎样才能得到它的字符串值?我在string.xml文件中提到了字符串值.
我是Android SDK/API环境的新手.这是我第一次尝试绘制情节/图表.我尝试使用3个不同的免费库运行不同类型的示例代码模拟器,在布局屏幕中没有显示任何内容.logcat重复以下消息:
W/Trace(1378): Unexpected value from nativeGetEnabledTags: 0 I/Choreographer(1378): Skipped 55 frames! The application may be doing too much work on its main thread.
当我运行与许可库的评估副本有关的示例代码时,问题不会持续存在并且图表有效.
我正在创建一个DialogFragment来显示有关我的应用程序的一些帮助消息.一切工作正常,除了一两件事:有一个在,显示DialogFragment窗口顶部的黑色条纹,那我相信是留给冠军,这是我不想用.
这是特别痛苦的,因为我的自定义DialogFragment使用白色背景,所以这种变化太臭名昭着,不能放在一边.
让我以更加图形化的方式向您展示:

现在我的DialogFragment的XML代码如下:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:id="@+id/holding"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/dialog_fragment_bg"
>
<!-- Usamos un LinearLayout para que la imagen y el texto esten bien alineados -->
<LinearLayout
android:id="@+id/confirmationToast"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<TextView android:id="@+id/confirmationToastText"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:text="@string/help_dialog_fragment"
android:textColor="#AE0000"
android:gravity="center_vertical"
/>
</LinearLayout>
<LinearLayout
android:id="@+id/confirmationButtonLL"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center_horizontal"
>
<Button android:id="@+id/confirmationDialogButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_marginBottom="60dp"
android:background="@drawable/ok_button">
</Button>
</LinearLayout>
</LinearLayout>
</ScrollView>
Run Code Online (Sandbox Code Playgroud)
以及实现DialogFragment的类的代码:
public class HelpDialog extends DialogFragment {
public HelpDialog() {
// Empty constructor required for DialogFragment
} …Run Code Online (Sandbox Code Playgroud) 这可能是一个很容易回答的问题,但经过几个小时的搜索文档和Google后,我自己找不到解决方案.我将Android应用的方向设置landscape在AndroidManifest.xml文件中:
android:screenOrientation="landscape"
Run Code Online (Sandbox Code Playgroud)
但是,当我在模拟器中运行应用程序时,它会出现在横向和纵向模式下.如何将模拟器切换到landscape模式mac?它正在运行1.6 SDK.
我的应用程序底部有一个垂直滑动抽屉.当软键盘打开时,它会向上推动抽屉的标签,使其位于键盘顶部.我实际上希望它保持在屏幕的底部,当键盘显示时隐藏.
其他人遇到这个问题?知道如何解决它吗?
我正在尝试实施Google几天前发布的新ActionBar支持库.在过去,我使用Google Developer's Support Library Setup页面上列出的相同方法成功实现了ActionBarSherlock,没有任何问题- 使用有关如何包含资源的指南(类似于ActionBarSherlock的工作方式).我将库项目作为库加载到我自己的项目中.
我可以告诉图书馆加载正常.当,而不是在我的MainActivity.java延伸活动,我改成了扩展ActionBarActivity(根据谷歌的说明),也不会出现错误 - 它正确导入.
我甚至尝试绕过style.xml文件并添加@style/Theme.AppCompat.Light到AndroidManifest.xml中两个直接<application>和<activity>具有android:theme="@style/ThemeAppCompat.Light"与导致同样的错误都尝试.
现在问题是我无法让它改变主题,更不用说甚至构建而不会抛出错误.下面是我收到的错误,后面是我更改为使用新主题的style.xml文件.
我有使用Android应用程序的适度经验,并且使用最新版本的支持库和使用API 18(Android 4.3)编译的SDK运行Eclipse.
构建期间收到错误
错误:检索项目的父项时出错:找不到与给定名称"@ style/Theme.AppCompat.Light"匹配的资源.styles.xml/ActBarTest/res/values line 3 Android AAPT问题
style.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.ProsoftStudio.ACTest" parent="@style/Theme.AppCompat.Light">
</style>
</resources>
Run Code Online (Sandbox Code Playgroud)
有什么建议?这从来都不是ActionBarSherlock的问题.我想继续使用这个新的支持库.几乎看起来.jar正在加载,但不是资源.
android android-theme android-actionbar android-actionbar-compat
我创建了一个包含两个按钮的布局,Next和Previous.在按钮之间,我正在生成一些动态视图.因此,当我第一次启动应用程序时,我想禁用"上一页"按钮,因为之前没有任何视图.我还想在没有更多要显示的视图时禁用"下一步"按钮.无论如何禁用按钮?

我有一个Live Android应用程序,从市场我收到了以下堆栈跟踪,我不知道为什么它发生在应用程序代码中没有发生,但它是由应用程序中的一些或其他事件引起的(假设)
我没有使用Fragments,仍然有FragmentManager的引用.如果任何机构可以对某些隐藏的事实进行一些说明以避免此类问题:
java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
at android.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:1109)
at android.app.FragmentManagerImpl.popBackStackImmediate(FragmentManager.java:399)
at android.app.Activity.onBackPressed(Activity.java:2066)
at android.app.Activity.onKeyDown(Activity.java:1962)
at android.view.KeyEvent.dispatch(KeyEvent.java:2482)
at android.app.Activity.dispatchKeyEvent(Activity.java:2274)
at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1668)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1112)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1112)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1112)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1112)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1112)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1112)
at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchKeyEvent(PhoneWindow.java:1720)
at com.android.internal.policy.impl.PhoneWindow.superDispatchKeyEvent(PhoneWindow.java:1258)
at android.app.Activity.dispatchKeyEvent(Activity.java:2269)
at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1668)
at android.view.ViewRoot.deliverKeyEventPostIme(ViewRoot.java:2851)
at android.view.ViewRoot.handleFinishedEvent(ViewRoot.java:2824)
at android.view.ViewRoot.handleMessage(ViewRoot.java:2011)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:132)
at android.app.ActivityThread.main(ActivityThread.java:4025)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:491)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
at dalvik.system.NativeStart.main(Native Method)
Run Code Online (Sandbox Code Playgroud)