本文介绍了查看鳍状肢不翻转的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这甚至可能吗?我创造了这个观点鳍和我打电话从的onClick的XML布局内的视图的鳍状肢。我创建了一个视图的鳍状肢前,但由于某种原因它不工作。

 <?XML版本=1.0编码=UTF-8&GT?;
< LinearLayout中的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
    机器人:layout_width =FILL_PARENT
    机器人:layout_height =FILL_PARENT
    机器人:cacheColorHint =@机器人:彩色/透明
    机器人:方向=垂直>    < ViewFlipper
        机器人:ID =@ + ID / viewFlipper1
        机器人:layout_width =match_parent
        机器人:layout_height =match_parent
        机器人:背景=@空
        机器人:cacheColorHint =@机器人:彩色/透明>        <的LinearLayout
            的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
            机器人:ID =@ + ID / vf_sample1_main
            机器人:layout_width =FILL_PARENT
            机器人:layout_height =FILL_PARENT
            机器人:cacheColorHint =@机器人:彩色/透明
            机器人:方向=垂直>            <包括布局=@布局/ headers_main/>            <包括布局=@布局/搜索栏/>            <的TextView
                机器人:ID =@ + ID / sdfsd
                机器人:layout_width =match_parent
                机器人:layout_height =WRAP_CONTENT
                机器人:layout_gravity =CENTER_HORIZONTAL
                机器人:重力=CENTER_HORIZONTAL
                安卓了maxHeight =85dp
                机器人:paddingBottom会=10dp
                机器人:paddingTop =10dp
                的onClick =gotoSomething
                机器人:单线=FALSE/>            <的TextView
                机器人:layout_width =match_parent
                机器人:layout_height =WRAP_CONTENT
                机器人:文字颜色=@彩色/ aquablue
                机器人:TEXTSIZE =15dp
                机器人:文字样式=大胆/>            <包括布局=@布局/ listview_item_row_now_playing_info/>            <的TextView
                机器人:layout_width =match_parent
                机器人:layout_height =WRAP_CONTENT
                机器人:文字颜色=@彩色/ aquablue
                机器人:TEXTSIZE =15dp
                机器人:文字样式=大胆/>            <包括布局=@布局/ container_listview/>
        < / LinearLayout中>        <的LinearLayout
            的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
            机器人:ID =@ + ID / vf_sdfsdfadf
            机器人:layout_width =FILL_PARENT
            机器人:layout_height =FILL_PARENT
            机器人:背景=@空
            机器人:cacheColorHint =@机器人:彩色/透明
            机器人:方向=垂直>            <包括布局=@布局/ header_vf_asdfasdfadadafsd/>
        < / LinearLayout中>        <的LinearLayout
            的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
            机器人:ID =@ + ID / vf_adsfasdfadsfasd
            机器人:layout_width =FILL_PARENT
            机器人:layout_height =FILL_PARENT
            机器人:背景=@空
            机器人:cacheColorHint =@机器人:彩色/透明
            机器人:方向=垂直>
        < / LinearLayout中>    < / ViewFlipper>< / LinearLayout中>

code:

 公共类BeatSpotPrototypeActivity扩展BaseListActivity {
        私人最终字符串标记= BeatSpotPrototypeActivity.class.getSimpleName();
        私人ApplicationStateManager mAppStateMananger = ApplicationStateManager.GetInstance();
        私人语境mCtx = NULL;
        私人布尔mIsInitalized = FALSE;
        私人布尔mD​​ataChanded = FALSE;
        私人ViewFlipper mViewFlipper = NULL;
        私人DrawableManager mDrawManager =新DrawableManager();
        私人枚举ViewFlipperModes {
            主(0),
            NOW_PLAYING(1),
            SONG_INFORMATION(2);            私人最终诠释指数;            ViewFlipperModes(INT指数){
                this.index =指数;
            }            公众诠释指数(){
                返回指数;
            }
        }
        < / code>
    < code>
        公共无效的onCreate(捆绑savedInstanceState){
            super.onCreate(savedInstanceState);
            的setContentView(R.layout.main_beatspot_activity);            如果(!mIsInitalized)
                在里面();
            其他
                mDataChanded = TRUE;
            showLoading(假);        }        私人无效的init(){
            mCtx =这一点;
            mIsInitalized = TRUE;
            mViewFlipper =(ViewFlipper)findViewById(R.id.viewFlipper);
            fadeDrawables();
        }
        公共无效gotoBeatspotMain(视图v){
            mViewFlipper.setDisplayedChild(ViewFlipperModes.MAIN.index());
        }        公共无效gotoNowPlaying(视图v){
            Log.d(TAG,mViewFlipper.getCurrentView()的toString());
            mViewFlipper.setDisplayedChild(ViewFlipperModes.NOW_PLAYING.index());
        }        公共无效gotoSongDetails(视图v){
            mViewFlipper.setDisplayedChild(ViewFlipperModes.SONG_INFORMATION.index());
            Log.d(TAG,将String.valueOf(ViewFlipperModes.SONG_INFORMATION.index()));
        }    }


解决方案

在上创建

  ViewFlipper mViewFlipper =(ViewFlipper)findViewbyId(位置);

在你的onCreate(),或在onStart

Also try this for me. before this line mViewFlipper.setDisplayedChild(ViewFlipperModes.MAIN.index());Type in:

int i = (ViewFlipperModes.MAIN.index()); place a debug point here
mViewFlipper.setDisplayedChild(i);

I also suggest using the debugger to try figure out if your flip views events are being called inside the debugger.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/book_as_whole_Layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" 
    android:background="#FFFFFF">

    <ViewFlipper 
            android:layout_marginTop="20dip"
            android:layout_marginLeft="20dip"
            android:layout_marginRight="20dip"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:id="@+id/ViewFlipper">
        <LinearLayout 
            android:layout_width="match_parent"
            android:layout_height="match_parent">

        <TextView 
            android:id="@+id/page1"
            android:text="@string/loading_string"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:textColor="#000000"
            android:typeface="serif"/>  

        </LinearLayout>

        <LinearLayout 
            android:layout_width="match_parent"
            android:layout_height="match_parent">
        <TextView 
            android:id="@+id/page2"
            android:text="@string/loading_string"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:textColor="#000000"
            android:typeface="serif" />  
        </LinearLayout>

    </ViewFlipper>


</LinearLayout>

这篇关于查看鳍状肢不翻转的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 07:03