安卓灯主题与动作栏

时间:2015-05-11 15:53:00

标签: android android-layout

我想使用灯光主题,但仍然可以看到操作栏。





来自这里看起来应该可行:




 < activity android: theme =“@ style / Theme.AppCompat.Light”...>
  




但是当我添加任何android:theme的动作栏时消失。





我可能遗漏了一些明显的东西...





编辑:万一有帮助





来自build.gradle




  apply plugin:'com.android .application'

 android {
 compileSdkVersion 21
 buildToolsVersion“21.1.2”

 defaultConfig {
 applicationId“com.company.app”
 minSdkVersion 15
 targetSdkVersion 21
 versionCode 5
 versionName“1.0”
 }
 buildTypes {
发布{
 minifyEnabled true
 proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro'
 }
 }
}

依赖关系{
编译fileTree(dir:'libs',include:['* .jar'])
编译'com.android.support:appcompat-v7:22.0.0'
}

activity_main.xml:




 < LinearLayout xmlns:android =“http://schemas.android.com/apk/res/android”
的xmlns:工具= “http://schemas.android.com/tools” 
机器人:ID = “@ + ID / screen_main” 
机器人:layout_width = “FILL_PARENT” 
机器人:layout_height = “FILL_PARENT” 
机器人:取向= “垂直” 
工具:上下文=>

 “OWG”。 < TextView android:id =“@ + id / textHeader”
机器人:TEXTSIZE = “24sp” 
机器人:文字颜色= “#006699” 
机器人:layout_width = “FILL_PARENT” 
机器人:layout_height = “WRAP_CONTENT” 
机器人:重力= “CENTER_HORIZONTAL” 
机器人:能见度= “看得见” 的
 />
 <的ListView
机器人:ID = “@机器人:ID /列表” 
机器人:layout_width = “FILL_PARENT” 
机器人:layout_height = “WRAP_CONTENT” 
 />
 < TextView android:id =“@ android:id / empty”
机器人:layout_width = “WRAP_CONTENT” 
机器人:layout_height = “WRAP_CONTENT” 
 android:text =“空集”
机器人:能见度= “看不见” 的
 />

</LinearLayout>

main.java

&#xA;
  package com.company.app;&#xA;&#xA; import android.app.AlertDialog;&#xA; import android.app.ListActivity;&#xA; import android。 os.Bundle;&#xA;导入android.widget.ListView;&#xA;导入android.content.Intent;&#xA;导入android.view.View;&#xA;&#xA;公共类Main扩展ListActivity {&#xA; private String [] mBooks = new String [] {“Informational”,“Extensions”};&#xA; protected void onCreate(Bundle savedInstanceState){&#xA; super.onCreate(savedInstanceState);&#XA;的setContentView(R.layout.activity_main);&#XA; MySimpleArrayAdapter booksAdapter = new MySimpleArrayAdapter(this,mBooks);&#xA;&#xA; ListView lv =(ListView)findViewById(android.R.id.list);&#xA; lv.setAdapter(booksAdapter);&#XA; }&#XA;&#XA;}&#XA;  
&#XA;

0 个答案:

没有答案