Java YouTube播放器没有';旋转设备时不能播放

Java YouTube播放器没有';旋转设备时不能播放,java,android,android-layout,android-youtube-api,Java,Android,Android Layout,Android Youtube Api,我在Android应用程序中使用YouTube API。一切都初始化得很好,视频在点击时播放,但当我选择全屏模式播放视频时,它只会强制手机旋转并播放视频1s,然后停止播放。当我再次尝试播放视频时,它会重复相同的动作:播放1秒,然后停止。如果您能帮助修复此错误,我将不胜感激。我有一个想法,听众有点不对劲,但我没有想出解决办法。我将在下面发布代码(主要是与YouTube播放器连接的代码片段…),如果您需要任何详细信息,欢迎询问 public class ItemScreen extends Acti

我在Android应用程序中使用YouTube API。一切都初始化得很好,视频在点击时播放,但当我选择全屏模式播放视频时,它只会强制手机旋转并播放视频1s,然后停止播放。当我再次尝试播放视频时,它会重复相同的动作:播放1秒,然后停止。如果您能帮助修复此错误,我将不胜感激。我有一个想法,听众有点不对劲,但我没有想出解决办法。我将在下面发布代码(主要是与YouTube播放器连接的代码片段…),如果您需要任何详细信息,欢迎询问

public class ItemScreen extends ActionBarActivity implements BaseSliderView.OnSliderClickListener, YouTubePlayer.OnInitializedListener {

public String VIDEO_ID;
private SliderLayout mDemoSlider;
private ClickableItem ci;
private RatingBar rb;
private SharedPreferences sp;
private String location;
private int position;
private TextView rating_text;
private double votes, voters;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.item_screen);
    //setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    mDemoSlider = (SliderLayout) findViewById(R.id.slider);
    TextView work_hours = (TextView) findViewById(R.id.work_hours);
    TextView address = (TextView) findViewById(R.id.address);
    TextView description = (TextView) findViewById(R.id.description);
    rating_text = (TextView) findViewById(R.id.rating_text);
    ImageButton pin = (ImageButton) findViewById(R.id.pin);
    final ImageButton number = (ImageButton) findViewById(R.id.number);
    final ImageButton email = (ImageButton) findViewById(R.id.email);
    rb = (RatingBar) findViewById(R.id.ratingBar);
    View divider = (View) findViewById(R.id.divider4);
    View otherDivider = (View) findViewById(R.id.divider3);

    FrameLayout frameLayout = (FrameLayout) findViewById(R.id.frame_layout);
    //YouTubePlayerSupportFragment youTubePlayerFragment = (YouTubePlayerSupportFragment) getSupportFragmentManager().findFragmentById(R.id.youtube_fragment);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    Intent i = getIntent();
    position = i.getIntExtra("position", 0);
    location = i.getStringExtra("location");
    if (location.equals("events")) {
        number.setVisibility(View.GONE);
        email.setVisibility(View.GONE);
    }
    if (location.equals("events") || location.equals("cinema")) {
        rb.setVisibility(View.GONE);
        divider.setVisibility(View.GONE);
    }

    ci = new ClickableItem();
    DatabaseHandler db = new DatabaseHandler(this);
    ci = db.getAllClickableItems(location).get(position);
    db.closeDB();
    getSupportActionBar().setTitle(ci.getName());

    if (location.equals("cinema")) {
        FragmentManager fragmentManager = getSupportFragmentManager();
        FragmentTransaction fragmentTransaction = fragmentManager
                .beginTransaction();

        YouTubePlayerSupportFragment fragment = new YouTubePlayerSupportFragment();
        fragmentTransaction.add(R.id.frame_layout, fragment);
        fragmentTransaction.commit();
        fragment.initialize(DeveloperKey.DEVELOPER_KEY, this);
        VIDEO_ID = ci.getTrailer();
        VIDEO_ID = getYoutubeVideoId(VIDEO_ID);
    } else {
        frameLayout.setVisibility(View.GONE);
        //otherDivider.
    }

    work_hours.setText(ci.getWork_hours());
    address.setText(ci.getAddress());
    description.setText(ci.getDescription());
    String foto_links = ci.getFoto_links();
    HashMap<String, String> url_maps = new HashMap<String, String>();
    String url, name_foto = ci.getName();
    int pos;
    if (!foto_links.contains(","))
        url_maps.put(name_foto, encode_url(foto_links, location));
    else
        while (!foto_links.equals("")) {
            pos = foto_links.indexOf(',');
            url = foto_links.substring(0, pos);
            url_maps.put(name_foto, encode_url(url, location));
            foto_links = foto_links.replace(url, "");
            foto_links = foto_links.substring(1);
            name_foto += " ";
            if (!foto_links.contains(",")) {
                url_maps.put(name_foto, encode_url(foto_links, location));
                break;
            }
        }

    for (String name : url_maps.keySet()) {
        TextSliderView textSliderView = new TextSliderView(this);
        textSliderView
                .description(name)
                .image(url_maps.get(name))
                .setScaleType(BaseSliderView.ScaleType.Fit)
                .setOnSliderClickListener(this);
        textSliderView.getBundle()
                .putString("extra", name);
        mDemoSlider.addSlider(textSliderView);
    }
    mDemoSlider.setPresetTransformer(SliderLayout.Transformer.Default);
    mDemoSlider.setPresetIndicator(SliderLayout.PresetIndicators.Center_Top);
    mDemoSlider.setCustomAnimation(new DescriptionAnimation());
    mDemoSlider.setDuration(4000);
    sp = getSharedPreferences("MyPrefs", MODE_PRIVATE);
    if (!sp.getBoolean(ci.getName(), true)) {
        rb.setRating(sp.getFloat(ci.getName() + " ", 0));
        votes = ci.getVotes() + Math.round(sp.getFloat(ci.getName() + " ", 0));
        voters = ci.getVoters() + 1;
        rating_text.setText("Dabartinis reitingas: " + String.format("%2.02f", votes / voters));
    } else if (ci.getVoters() != 0) {
        votes = ci.getVotes();
        voters = ci.getVoters();
        rating_text.setText("Dabartinis reitingas: " + String.format("%2.02f", votes / voters));
    } else {
        voters = votes = 0;
    }

    rb.setOnRatingBarChangeListener(new RatingBar.OnRatingBarChangeListener() {
        @Override
        public void onRatingChanged(RatingBar ratingBar, final float rating, boolean fromUser) {
            if (rating != 0)
                if (sp.getBoolean(ci.getName(), true)) {
                    if (checkInternetConnection()) {
                        RequestQueue queue = Volley.newRequestQueue(getApplicationContext());
                        StringRequest postRequest = new StringRequest(Request.Method.POST, "SERVER",
                                new Response.Listener<String>() {
                                    @Override
                                    public void onResponse(String response) {
                                    }
                                },
                                new Response.ErrorListener() {
                                    @Override
                                    public void onErrorResponse(VolleyError error) {
                                        Log.d("Error.Response", error.toString());
                                    }
                                }
                        ) {
                            @Override
                            protected Map<String, String> getParams() {
                                Map<String, String> params = new HashMap<String, String>();
                                params.put("table", location);
                                params.put("name", ci.getName());
                                params.put("vote", String.valueOf(Math.round(rating)));
                                return params;
                            }
                        };
                        queue.add(postRequest);
                        Toast.makeText(getApplicationContext(), "Tavo balsas išsiųstas!", Toast.LENGTH_SHORT).show();
                        SharedPreferences.Editor editor = sp.edit();
                        editor.putBoolean(ci.getName(), false);
                        editor.putFloat(ci.getName() + " ", rating);
                        editor.commit();
                        votes = ci.getVotes() + rating;
                        voters = ci.getVoters() + 1;
                        rating_text.setText("Dabartinis reitingas: " + String.format("%2.02f", votes / voters));
                    } else {
                        rb.setRating(0);
                    }
                } else {
                    rb.setRating(sp.getFloat(ci.getName() + " ", 0));
                    Toast.makeText(getApplicationContext(), "Tu jau balsavai už šią vietą!", Toast.LENGTH_SHORT).show();
                }
        }
    });

    number.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            //number.setImageResource(R.drawable.telefonas_clicked);
            Intent callIntent = new Intent(Intent.ACTION_CALL);
            callIntent.setData(Uri.parse("tel:" + ci.getNumber()));
            startActivity(callIntent);
        }
    });
    email.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            //email.setImageResource(R.drawable.laiskas_clicked);
            Intent email = new Intent(Intent.ACTION_SEND);
            email.putExtra(Intent.EXTRA_EMAIL, new String[]{ci.getEmail()});
            email.putExtra(Intent.EXTRA_SUBJECT, "Aš naudojuosi Miesto Meniu!");
            email.setType("message/rfc822");
            startActivity(Intent.createChooser(email, "Pasirinkite programėlę"));

        }
    });
    pin.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent i = new Intent(getApplicationContext(), Maps.class);
            i.putExtra("location", location);
            i.putExtra("position", position);
            i.putExtra("one", true);
            startActivity(i);
        }
    });
}

@Override
public void onSliderClick(BaseSliderView slider) {
}

private String encode_url(String url, String loc) {
    Log.d("url tikras: ", url);
    String nereikalinga = url.split("/")[url.split("/").length - 1];
    Log.d("nereikalinga: ", nereikalinga);
    try {
        Log.d("toks url: ", url.replace(nereikalinga, (URLEncoder.encode(nereikalinga, "UTF-8"))));
        if (!loc.equals("events"))
            return url.replace(nereikalinga, (URLEncoder.encode(nereikalinga, "UTF-8")));
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }
    return url;
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater menuInflater = getMenuInflater();
    menuInflater.inflate(R.menu.item_screen, menu);
    return super.onCreateOptionsMenu(menu);
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case android.R.id.home:
            onBackPressed();
            return true;
        case R.id.share:
            Intent emailIntent = new Intent(Intent.ACTION_SEND);
            emailIntent.setData(Uri.parse("mailto:"));
            emailIntent.setType("text/plain");
            emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Aš naudojuosi Miesto Meniu!");
            emailIntent.putExtra(Intent.EXTRA_TEXT, ci.getName() + "\n" + "\n" +
                    ci.getAddress() + "\n" + "\n" + ci.getWork_hours() + "\n" + "\n" +
                    ci.getDescription() + "\n" + "\n" + ci.getNumber() + "\n" + "\n" +
                    ci.getEmail());
            try {
                startActivity(Intent.createChooser(emailIntent, "Pasirinkite programėlę"));
            } catch (android.content.ActivityNotFoundException ex) {
                Toast.makeText(ItemScreen.this,
                        "Klaida!", Toast.LENGTH_SHORT).show();
            }
            break;
    }
    return super.onOptionsItemSelected(item);
}

private boolean checkInternetConnection() {
    ConnectionDetector cd = new ConnectionDetector(this);
    Boolean isInternetPresent = cd.isConnectingToInternet();
    if (!isInternetPresent) {
        AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
        alertDialogBuilder
                .setTitle("Nėra interneto ryšio!")
                .setMessage("Programėlei reikalingas interneto ryšys, norint balsuoti")
                .setCancelable(false)
                .setPositiveButton("Gerai", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        //rb.setActivated(false);
                    }
                });
        AlertDialog alertDialog = alertDialogBuilder.create();
        alertDialog.show();
        return false;
    }
    return true;
}

@Override
public void onInitializationFailure(YouTubePlayer.Provider provider, YouTubeInitializationResult result) {
    Toast.makeText(this, "Klaida!", Toast.LENGTH_LONG).show();
}


@Override
public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer player, boolean wasRestored) {

    player.setPlayerStateChangeListener(playerStateChangeListener);
    player.setPlaybackEventListener(playbackEventListener);

    if (!wasRestored) {
        player.cueVideo(VIDEO_ID);
    }
}

private YouTubePlayer.PlaybackEventListener playbackEventListener = new YouTubePlayer.PlaybackEventListener() {

    @Override
    public void onBuffering(boolean arg0) {

    }

    @Override
    public void onPaused() {

    }

    @Override
    public void onPlaying() {

    }

    @Override
    public void onSeekTo(int arg0) {

    }

    @Override
    public void onStopped() {

    }

};

private YouTubePlayer.PlayerStateChangeListener playerStateChangeListener = new YouTubePlayer.PlayerStateChangeListener() {

    @Override
    public void onAdStarted() {

    }

    @Override
    public void onError(YouTubePlayer.ErrorReason arg0) {

    }

    @Override
    public void onLoaded(String arg0) {

    }

    @Override
    public void onLoading() {
    }

    @Override
    public void onVideoEnded() {

    }

    @Override
    public void onVideoStarted() {

    }
};

//@Override

protected YouTubePlayer.Provider getYouTubePlayerProvider() {
    return (YouTubePlayerSupportFragment) getSupportFragmentManager().findFragmentById(R.id.youtube_fragment);
}

public static String getYoutubeVideoId(String youtubeUrl) {
    String video_id = "";
    if (youtubeUrl != null && youtubeUrl.trim().length() > 0 && youtubeUrl.startsWith("http")) {

        String expression = "^.*((youtu.be" + "\\/)" + "|(v\\/)|(\\/u\\/w\\/)|(embed\\/)|(watch\\?))\\??v?=?([^#\\&\\?]*).*"; // var regExp = /^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#\&\?]*).*/;
        CharSequence input = youtubeUrl;
        Pattern pattern = Pattern.compile(expression, Pattern.CASE_INSENSITIVE);
        Matcher matcher = pattern.matcher(input);
        if (matcher.matches()) {
            String groupIndex1 = matcher.group(7);
            if (groupIndex1 != null && groupIndex1.length() == 11)
                video_id = groupIndex1;
        }
    }
    return video_id;
}
}
公共类ItemScreen扩展ActionBarActivity实现BaseSliderView.OnSliderClickListener、YouTubeplyer.OnInitializedListener{
公共字符串视频标识;
专用滑块布局MDEMOSLEADER;
私有可点击项ci;
私人评级杆rb;
私人共享参考sp;
私有字符串位置;
私人职位;
私有文本查看评级_文本;
私人双票,选民;
@凌驾
创建时受保护的void(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.item_屏幕);
//setRequestedOrientation(ActivityInfo.SCREEN\u ORIENTATION\u Picture);
mDemoSlider=(SliderLayout)findViewById(R.id.slider);
TextView工时=(TextView)findViewById(R.id.work\u hours);
TextView地址=(TextView)findViewById(R.id.address);
TextView描述=(TextView)findViewById(R.id.description);
rating_text=(TextView)findViewById(R.id.rating_text);
ImageButton pin=(ImageButton)findViewById(R.id.pin);
最终ImageButton编号=(ImageButton)findViewById(R.id.number);
最终ImageButton电子邮件=(ImageButton)findViewById(R.id.email);
rb=(额定值条)findViewById(R.id.额定值条);
视图分隔符=(视图)findViewById(R.id.divider4);
视图其他分割器=(视图)findViewById(R.id.divider3);
FrameLayout=(FrameLayout)findViewById(R.id.frame\u布局);
//YouTubePlayerSupportFragment YouTubePlayerSupportFragment=(YouTubePlayerSupportFragment)getSupportFragmentManager().findffragmentbyid(R.id.youtube_fragment);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
Intent i=getIntent();
位置=i.getIntExtra(“位置”,0);
位置=i.getStringExtra(“位置”);
if(位置等于(“事件”)){
编号.setVisibility(视图.消失);
email.setVisibility(View.GONE);
}
if(location.equals(“事件”)| | location.equals(“电影院”)){
rb.setVisibility(View.GONE);
分隔器.setVisibility(View.GONE);
}
ci=新的可点击项();
DatabaseHandler db=新的DatabaseHandler(此);
ci=db.getAllClickableItems(位置).get(位置);
db.closeDB();
getSupportActionBar().setTitle(ci.getName());
if(位置等于(“电影院”)){
FragmentManager FragmentManager=getSupportFragmentManager();
FragmentTransaction FragmentTransaction=fragmentManager
.beginTransaction();
YouTubePlayerSupportFragment=新的YouTubePlayerSupportFragment();
fragmentTransaction.add(R.id.frame\u布局,fragment);
fragmentTransaction.commit();
初始化(DeveloperKey.DEVELOPER_KEY,this);
VIDEO_ID=ci.getTrailer();
VIDEO\u ID=getYoutubeVideoId(VIDEO\u ID);
}否则{
frameLayout.setVisibility(View.GONE);
//其他分割器。
}
work_hours.setText(ci.getWork_hours());
address.setText(ci.getAddress());
description.setText(ci.getDescription());
字符串foto_links=ci.getFoto_links();
HashMap url_maps=新建HashMap();
字符串url,name_foto=ci.getName();
int pos;
如果(!foto_links.contains(“,”))
url_maps.put(name_foto,encode_url(foto_链接,位置));
其他的
而(!foto_links.equals(“”){
pos=foto_links.indexOf(',');
url=foto_links.substring(0,pos);
url_maps.put(name_foto,encode_url(url,location));
foto_links=foto_links.replace(url,“”);
foto_links=foto_links.substring(1);
名称_foto+=“”;
如果(!foto_links.contains(“,”)){
url_maps.put(name_foto,encode_url(foto_链接,位置));
打破
}
}
for(字符串名称:url\u maps.keySet()){
TextSliderView TextSliderView=新的TextSliderView(此);
文本幻灯片视图
.说明(姓名)
.image(url_maps.get(名称))
.setScaleType(BaseSliderView.ScaleType.Fit)
.setOnSliderClickListener(本);
textSliderView.getBundle()
.putString(“额外”,名称);
mDemoSlider.addSlider(textSliderView);
}
mdemosiler.setPresetTransformer(SliderLayout.Transformer.Default);
mDemoSlider.setPresetIndicator(滑块布局.PresetIndicators.Center\u Top);
setCustomAnimation(新的DescriptionAnimation());
mdemosider.setDuration(4000);
sp=GetSharedReferences(“MyPrefs”,模式为私有);
如果(!sp.getBoolean(ci.getName(),true)){
rb.setRating(sp.getFloat(ci.getName()+“”,0));
投票数=ci.getvoals()+Math.round(sp.getFloat(ci.getName()+“”,0));
投票者=ci.getvoctors()+1;
rating_text.setText(“Dabartinis reitingas:+String.format(“%2.02f”,选票/选民));
}else if(ci.getvorters()!=0){
投票数=ci.getvoces();
投票者=ci.getvoctors();
rating_text.setText(“Dabartinis reitingas:+String.format(“%2.02f”,选票/选民));
}否则{
选民=选票=0;
}
rb.setOnRatingBarChangeListener(新的RatingBar.OnRatingBarChangeListener(){
@凌驾
公共无效率已更改(率条率条,最终浮动率,布尔值fromUser){
如果(额定值!=0)
if(sp.getBoolean(ci.getName(),true))
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:custom="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center"
tools:context="com.daimajia.slider.demo.MainActivity">

<ScrollView
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="1"
    android:fillViewport="true"
    android:background="@drawable/background">

    <!--android:margin="5dp"-->

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:padding="5dp"
        android:id="@+id/relative_layout"
        android:background="#4D000000">

        <com.daimajia.slider.library.SliderLayout
            android:id="@+id/slider"
            android:layout_width="match_parent"
            custom:pager_animation="Default"
            custom:indicator_visibility="visible"
            custom:pager_animation_span="1100"
            android:layout_height="200dp" />

        <TextView
            android:id="@+id/address"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Konstitucijos pr. 7A, Vilnius"
            android:textColor="#FFFFFF"
            android:layout_below="@+id/slider"
            android:layout_marginTop="15dp" />

        <ImageButton
            android:id="@+id/pin"
            android:layout_width="32dp"
            android:layout_height="32dp"
            android:layout_below="@+id/slider"
            android:layout_alignParentRight="true"
            android:layout_marginRight="5dp"
            android:background="@drawable/pin"
            android:layout_marginTop="5dp" />

        <View
            android:id="@+id/divider1"
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:background="#433b39"
            android:layout_below="@id/address"
            android:layout_marginTop="10dp" />

        <TextView
            android:id="@+id/work_hours"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/divider1"
            android:text="I - VI 10:00 - 21:00, VII 10:00 - 20:00"
            android:textColor="#FFFFFF"
            android:layout_marginTop="10dp" />

        <View
            android:id="@+id/divider2"
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:background="#433b39"
            android:layout_below="@id/work_hours"
            android:layout_marginTop="10dp" />

        <TextView
            android:id="@+id/description"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/divider2"
            android:layout_marginTop="10dp"
            android:text="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
            android:textColor="#FFFFFF" />

        <FrameLayout
            android:id="@+id/frame_layout"
            android:layout_below="@+id/description"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <fragment
                android:name="com.google.android.youtube.player.YouTubePlayerFragment"
                android:id="@+id/youtube_fragment"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />
        </FrameLayout>

        <View
            android:id="@+id/divider3"
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:background="#575350"
            android:layout_below="@id/frame_layout"
            android:layout_marginTop="10dp" />

        <RelativeLayout
            android:layout_below="@+id/divider3"
            android:layout_width="match_parent"
            android:id="@+id/rl"
            android:layout_height="wrap_content">

            <RatingBar
                android:id="@+id/ratingBar"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerInParent="true"
                android:numStars="5"
                android:stepSize="1.0"
                android:rating="0" />

            <TextView
                android:layout_width="match_parent"
                android:id="@+id/rating_text"
                android:layout_below="@+id/ratingBar"
                android:layout_height="wrap_content"
                android:gravity="center"/>

        </RelativeLayout>

        <View
            android:id="@+id/divider4"
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:background="#575350"
            android:layout_below="@id/rl" />

        <LinearLayout
            android:layout_below="@id/divider4"
            android:layout_height="wrap_content"
            android:layout_width="match_parent"
            android:orientation="horizontal"
            android:layout_margin="5dp"
            android:clickable="true">

            <TextView
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1.0"
                android:text="" />

            <ImageButton
                android:id="@+id/number"
                android:layout_height="wrap_content"
                android:layout_width="wrap_content"
                android:background="@drawable/phone" />

            <TextView
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1.0"
                android:text="" />

            <TextView
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1.0"
                android:text="" />

            <ImageButton
                android:id="@+id/email"
                android:layout_height="wrap_content"
                android:layout_width="wrap_content"
                android:background="@drawable/mail" />

            <TextView
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1.0"
                android:text="" />
        </LinearLayout>

    </RelativeLayout>

</ScrollView>

<com.daimajia.slider.library.Indicators.PagerIndicator
    android:id="@+id/custom_indicator2"
    style="@style/AndroidImageSlider_Corner_Oval_Orange"
    android:layout_marginBottom="10dp"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" />

<com.daimajia.slider.library.Indicators.PagerIndicator
    android:id="@+id/custom_indicator"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:gravity="center"
    custom:selected_color="#0095BF"
    custom:unselected_color="#55333333"
    custom:shape="oval"
    custom:selected_padding_left="5dp"
    custom:selected_padding_right="5dp"
    custom:unselected_padding_left="5dp"
    custom:unselected_padding_right="5dp"
    custom:selected_width="6dp"
    custom:selected_height="6dp"
    custom:unselected_width="6dp"
    custom:unselected_height="6dp"/>