使用v7首选项支持库中的新PreferenceFragmentCompat:http://developer.android.com/tools/support-library/features.html#v7-preference,我收到此错误
E java.lang.IllegalStateException: Must specify preferenceTheme in theme
E at android.support.v7.preference.PreferenceFragmentCompat.onCreate(PreferenceFragmentCompat.java:202)
Run Code Online (Sandbox Code Playgroud)
应该设置什么主题?
更新:我尝试过使用
<item name="preferenceTheme">@style/PreferenceThemeOverlay</item>
正如@Bogato所建议的那样,它看起来并不正确,即使在Lollipop上也看起来非常Holo.
支持库:
原生偏好:
android android-fragments android-support-library preferencefragment preference-v7
我有几个与Cache-Control相关的查询.
如果我max-age=3600, must-revalidate为静态html/js/images/css文件指定Cache-Control ,并在HTTP标头中定义了Last Modified Header:
如果有人可以帮我使用如何使用shape drawable作为我的视图的背景xml,我真的很感激.
这就是我的尝试:但我从未得到过这种颜色.Android总是在白色背景上给我黑色文字,无论我放置什么颜色属性.
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke android:width="1dip" android:color="#FBBB" />
<solid android:color="#6000"/>
</shape>
Run Code Online (Sandbox Code Playgroud)
我试过了,不行
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"
android:color="#6000>
</shape>
Run Code Online (Sandbox Code Playgroud)
我试过了,不行
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"
android:background="#6000>
</shape>
Run Code Online (Sandbox Code Playgroud)
我谷歌这是我发现尝试的有限结果.
我在XML中选择了一个id,鼠标右键单击,查找用法显示在java文件中不存在id甚至Id.如果我在Mac上做同样的事情就找到它.
那么有任何缓存问题或其他什么?
有没有办法在MapView上始终显示缩放控件?我已经添加了缩放控件
map=(MapView)findViewById(R.id.map);
map.setBuiltInZoomControls(true);
Run Code Online (Sandbox Code Playgroud)
但缩放控件淡入和淡出.我希望它们始终可见.
我希望在我的应用中有一个"更改主题"功能.如果我在onCreate()中调用setTheme(),则有一个问题.
在我启动应用程序后的那一刻,一个普通的白色背景出现了一秒钟(因为我在清单中设置了浅色主题).之后,将显示我的活动的完整布局 - 根据用户的主题偏好,它可以是白色或黑色背景.
有什么方法可以改变发射后是否出现白色或黑色背景?
对于Honeycomb,我已将listview项目设置为使用?android:attr/activatedBackgroundIndicator样式,以便在选中时保持突出显示.
如何更改突出显示的颜色?
我正在Google Play Services使用以下代码显示AccountPicker对话框:
String[] accountTypes = new String[]{"com.google"};
Intent intent = AccountPicker.newChooseAccountIntent(null, null,
accountTypes, false, null, null, null, null);
startActivityForResult(intent, REQUEST_CODE_PICK_ACCOUNT);
Run Code Online (Sandbox Code Playgroud)
它看起来像一个黑暗的主题对话框,即使我正在使用AppCompat v21 Theme.AppCompat.Light.
是否可以设置对话框的样式?最好作为Material dialog on Lollipop但至少使它成为一个轻的对话框来匹配我的应用程序.
我想构建一个没有 PhoneGap 的 Android webApplication,我有一个问题:当我点击一个链接时,它会打开 android 默认浏览器...:那么如何在同一个 webview Android 中加载 webview 链接?
这是我的代码:
package com.example.mobilewebview;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.webkit.WebView;
//import android.webkit.WebViewClient;
import android.webkit.WebSettings;
public class MainActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
WebView myWebView = (WebView) findViewById(R.id.webview);
WebSettings webSettings = myWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
myWebView.loadUrl("http://m.google.com");
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
}
Run Code Online (Sandbox Code Playgroud)
谢谢 !
如何在Android HoneyComb中隐藏或删除状态栏?每次运行我的应用程序时,我都会发现状态栏必须包含一些内容.
我试图改变AndroidManifest.xml,但没有改变.
我正在使用 AndroidSlidingUpPanel 库。 https://github.com/umano/AndroidSlidingUpPanel
我的activity_main.xml 有两个孩子。第一个孩子是主要布局。第二个孩子是上滑面板的布局。在这里,我发布了向上滑动面板的布局。以 15 : 15 : 60 : 10 % 的比例百分比定义了 4 个 LinearLayout。第一个布局将在面板中可见。现在我希望面板高度是第一个布局的 3/4。所以在这里,第一个布局占据屏幕的 15%,但面板高度应该在屏幕的 10-12% 左右。
有什么方法或公式可以用来获取屏幕尺寸并根据此处提供的 xml 文件的第一个布局设置面板高度。
我试图在 Java 代码中定义面板高度。但直到现在还没有成功。有时面板中也会显示第二个布局,有时只有第一个布局的一半或 1/4。
PS:有没有办法在 setContentView() 之前找到视图的高度?
<LinearLayout
android:layout_width="match_parent"
android:layout_height="5dp"
android:layout_weight="1.5"
android:background="#666666" >
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="5dp"
android:layout_weight="1.5"
android:background="#888888" >
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="6"
android:background="#eeeeee" >
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#202033" >
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)