2016-08-01 13 views
0

ListViewを使用しようとしている間、プレビューでエラーが発生しています。ListViewを使用できません

慎重にアンドロイドデバイスの下を見てください。エラー。

this is the screenshot of my problem それはまた言う私は、まだこのリストビューにアダプタを追加していない

「現在のテーマにスタイル 『listViewStyle』が見つかりませんでした」。それが問題なら、教えてください。

この活動のための私のJavaコード

package com.justforyou.bestnarutosongs; 

import android.media.AudioManager; 
import android.media.MediaPlayer; 
import android.os.Bundle; 
import android.support.v7.app.AppCompatActivity; 
import android.view.WindowManager; 

public class SongsListActivity extends AppCompatActivity { 

private MediaPlayer mediaplayer; 
private AudioManager mAudioManager; 
private AudioManager.OnAudioFocusChangeListener mOnAudioFocusChangeListener = new AudioManager.OnAudioFocusChangeListener() 
{ 
    @Override 
    public void onAudioFocusChange(int focusChange){ 
     if(focusChange == AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK || focusChange == AudioManager.AUDIOFOCUS_LOSS_TRANSIENT){ 
      mediaplayer.pause(); 
      mediaplayer.seekTo(0); 
     } 
     else if(focusChange == AudioManager.AUDIOFOCUS_GAIN){ 
      mediaplayer.start(); 
     } 
     else if(focusChange == AudioManager.AUDIOFOCUS_LOSS){ 
      if(mediaplayer != null) 
      { 
       mediaplayer.release(); 
       mediaplayer = null; 
      } 
     } 
    } 
}; 

@Override 
protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); 
    setContentView(R.layout.activity_songs_list); 
} 
} 

ここで私のstyle.xml

<!-- Copyright (C) 2016 The Android Open Source Project 

Licensed under the Apache License, Version 2.0 (the "License"); 
you may not use this file except in compliance with the License. 
You may obtain a copy of the License at 

     http://www.apache.org/licenses/LICENSE-2.0 

Unless required by applicable law or agreed to in writing, software 
distributed under the License is distributed on an "AS IS" BASIS, 
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
See the License for the specific language governing permissions and 
limitations under the License. 
--> 

<!-- Base application theme. --> 
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> 
    <item name="colorPrimary">@color/primary_color</item> 
    <item name="colorPrimaryDark">@color/primary_dark_color</item> 
</style> 

<!-- Style for a category of vocabulary words --> 
<style name="CategoryStyle"> 
    <item name="android:layout_width">match_parent</item> 
    <item name="android:layout_height">@dimen/list_item_height</item> 
    <item name="android:gravity">center_vertical</item> 
    <item name="android:padding">16dp</item> 
    <item name="android:textColor">@android:color/white</item> 
    <item name="android:textStyle">bold</item> 
    <item name="android:textAppearance">?android:textAppearanceMedium</item> 
</style> 

+0

あなたが24から23に、ドロップダウンメニューを変更しようとしたことがありますか? –

答えて

1

変更は右上隅からAPIレベルであり、現在変更後はアプリケーションを実行します。私はそれがうまくいくことを望む。

+0

いいえ、私はしません。私はすでにそれを試した。 –

2

あなたは、この例のように...などRelativeLayout、のLinearLayout、などの特定のレイアウトに

をあなたのリストビューを置く必要があります。

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:padding="6dip" > 

    <ListView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/listview" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" /> 

</RelativeLayout> 
関連する問題