标题栏不会显示在活动中

时间:2016-12-03 13:39:38

标签: android titlebar

标题栏在此活动中没有显示任何人都可以查看错误

即使我把它放在清单文件中

机器人:主题=" @风格/ Theme.AppCompat.DayNight"

仍然无法运作

activity_gallery.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_gallery"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:theme="@style/AppTheme"
tools:context="com.example.kemo.cleantest.gallery">    
</LinearLayout>

gallery.java文件

package com.example.kemo.cleantest;
    public class gallery extends Activity implements SimpleGestureListener{
        private SimpleGestureFilter detector;
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_gallery);
            ImageView imageView5 = (ImageView) findViewById(R.id.imageView5);
            TypedArray images = getResources().obtainTypedArray(R.array.loading_images);
            int choicer = (int) (Math.random() * images.length());
            imageView5.setImageResource(images.getResourceId(choicer, R.drawable.pic1));
            images.recycle();
            detector = new SimpleGestureFilter(this,this);
        }
        @Override
        public boolean dispatchTouchEvent(MotionEvent me){
            this.detector.onTouchEvent(me);
            return super.dispatchTouchEvent(me);
        }
        @Override
        public void onSwipe(int direction) {
            int choice;
            ImageView imageView5 = (ImageView) findViewById(R.id.imageView5);
            TypedArray images = getResources().obtainTypedArray(R.array.loading_images);
                switch (direction) {
                    case 
                       choice = (int) (Math.random() * images.length());
                    imageView5.setImageResource(images.getResourceId(choice, R.drawable.pic1));
                        images.recycle();
                        break;
                    case 
                       choice = (int) (Math.random() * images.length());
                       imageView5.setImageResource(images.getResourceId(choice, R.drawable.pic1));
                        images.recycle();
                        break;
                }
        }
    }

0 个答案:

没有答案