相关疑难解决方法(0)

带有页面指示器的Android视图寻呼机

我需要在视图分页器文件中获取包含图像的页面指示符.这是我的代码.

public class IndicatorActivity extends Activity {


 /** Called when the activity is first created. */
    @Override

        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);

            MyPagerAdapter adapter = new MyPagerAdapter();
            ViewPager myPager = (ViewPager) findViewById(R.id.pager);
            myPager.setAdapter(adapter);
            myPager.setCurrentItem(0);
            TitlePageIndicator indicator = (TitlePageIndicator)findViewById(R.id.indicat);
            indicator.setViewPager( myPager );
    }
}
Run Code Online (Sandbox Code Playgroud)

在这段代码中,我得到一个错误 TitlePageIndicator indicator = (TitlePageIndicator)findViewById(R.id.indicat);TitlePageIndicator cannot be resolved to a type.这是什么错误.我该如何解决?

这是我的xml代码:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <android.support.v4.view.ViewPager
        android:id="@+id/pager"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
         />
    <com.viewpagerindicator.TitlePageIndicator
    android:id="@+id/indicat"
    android:layout_height="wrap_content"
    android:layout_width="fill_parent" />
</LinearLayout> …
Run Code Online (Sandbox Code Playgroud)

android activity-indicator android-view android-viewpager viewpagerindicator

27
推荐指数
4
解决办法
10万
查看次数

如何在eclipse中将GitHub库包含到现有的Android项目中

我想将这个库从github 包含到我现有的项目中,我正在使用eclipse.有没有关于如何做到这一点的教程?我是android和java开发的新手,所以任何一步一步的帮助都会很棒!

注意:我在eclipse中安装了一个Egit插件.


我尝试从github页面下载的解压缩文件导入库时屏幕的图像: 在此输入图像描述


在导入库之后,如下所示,在我的Package Explorer中创建的库文件夹,但这是我得到的: 在此输入图像描述


我现在在eclipse Package explorer中有了库,现在我想将它添加到我的项目中,所以我右键单击现有项目并选择属性.在Android liabrary下我点击确定并选择库而不是没有任何反应!

import android github

10
推荐指数
1
解决办法
1万
查看次数