1,音乐播放器
需求:很简单能播放音乐 ,下一首上一首。就完事。还有个翻页 按类型查找。
2,电影播放器:能够播放电影,快进,后退。这里直接用的 框架。
由于比较简单,就全部写在一个页面了。判断数据类型。显示不同的页面。
下面是代码;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.SeekBar;
import android.widget.TextView;
import android.widget.Toast;
import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.callback.StringCallback;
import com.lzy.okgo.model.Response;
import java.io.IOException;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import cn.jzvd.JZVideoPlayer;
import cn.jzvd.JZVideoPlayerStandard;
import spa.nabo.com.nabospa.R;
import spa.nabo.com.nabospa.adapter.DianshiJvAdapter;
import spa.nabo.com.nabospa.adapter.MovieTypeAdapter;
import spa.nabo.com.nabospa.adapter.MoviesAdapter;
import spa.nabo.com.nabospa.adapter.MusicAdapter;
import spa.nabo.com.nabospa.adapter.MusicTypeAdapter;
import spa.nabo.com.nabospa.base.BaseActivity;
import spa.nabo.com.nabospa.bean.MusicBean;
import spa.nabo.com.nabospa.bean.MusicTypeBean;
import spa.nabo.com.nabospa.bean.VideosBeans;
import spa.nabo.com.nabospa.bean.VideosTypeBean;
import spa.nabo.com.nabospa.config.Config;
import spa.nabo.com.nabospa.config.URL;
import spa.nabo.com.nabospa.utils.GsonUtils;
import static spa.nabo.com.nabospa.config.URL.getVideos;
/**
* Created by ${陈文杰} on 2018/4/2 0002.
* Email:1181620038@qq.com
* 描述:电影
*/
public class MoviesActivity extends BaseActivity implements MediaPlayer.OnCompletionListener, MediaPlayer.OnErrorListener, Runnable, View.OnClickListener {
@BindView(R.id.back_ll)
LinearLayout backLl;
@BindView(R.id.movie_type_rl)
RecyclerView movieTypeRl;
@BindView(R.id.zuixin_tv)
TextView zuixinTv;
@BindView(R.id.zuire_tv)
TextView zuireTv;
@BindView(R.id.haoping_tv)
TextView haopingTv;
@BindView(R.id.title)
spa.nabo.com.nabospa.view.title title;
@BindView(R.id.movie_rv)
RecyclerView movieRv;
@BindView(R.id.movie_ll)
LinearLayout movieLl; // 默认显示页面
@BindView(R.id.movie_xiangqing_ll)
RelativeLayout movieXiangqingLl;//详情页面
@BindView(R.id.left_iv)
ImageView leftIv;
@BindView(R.id.yeshu)
TextView yeshu;
@BindView(R.id.right_iv)
ImageView rightIv;
@BindView(R.id.xq_movie_iv)
ImageView xqMovieIv;
@BindView(R.id.xq_movie_name_tv)
TextView xqMovieNameTv;//名称
@BindView(R.id.xq_movie_zhuyan_tv)
TextView xqMovieZhuyanTv;//主演
@BindView(R.id.xq_movie_daoyan_tv)
TextView xqMovieDaoyanTv;//导演
@BindView(R.id.xq_movie_type_tv)
TextView xqMovieTypeTv;//电影类型
@BindView(R.id.xq_movie_addr_tv)
TextView xqMovieAddrTv;//地址
@BindView(R.id.xq_movie_paleyNum_tv)
TextView xqMoviePaleyNumTv;//播放次数
@BindView(R.id.xq_movie_jishu_rc)
RecyclerView xqMovieJishuRc;//每一集
@BindView(R.id.xq_movie_jianjie_tv)
TextView xqMovieJianjieTv;// 介绍
@BindView(R.id.hei_ll)
LinearLayout heiLl; //电影和音乐,不同的高度
@BindView(R.id.fanye_ll)
LinearLayout fanyeLl;//f翻页按钮
/*音乐控件*/
@BindView(R.id.music_play_img)
ImageView musicPlayImg; //当前播放的音乐图片
@BindView(R.id.music_play_shang)
ImageView musicPlayShang;//上一首
@BindView(R.id.music_play_stop)
ImageView musicPlayStop;//播放/暂停
@BindView(R.id.music_play_next)
ImageView musicPlayNext;//下一首
@BindView(R.id.music_info_tv)
TextView musicInfoTv;//歌曲名字-歌手
@BindView(R.id.music_play_volume1_sb)
SeekBar musicPlayVolume1Sb;//音量的控制
@BindView(R.id.music_play_sb)
SeekBar musicPlaySb;//进度条的控制
@BindView(R.id.music_play_time_tv)
TextView musicPlayTimeTv;//播放时间
@BindView(R.id.music_play_times_tv)
TextView musicPlayTimesTv;//总时长
@BindView(R.id.play_music_ll)
LinearLayout playMusicLl;//进入音乐就显示这个。电影就隐藏
private List<VideosTypeBean.MsgBodyBean> listVideoType;//电影类型
private MovieTypeAdapter typeAdapter;//类型 适配器
private MoviesAdapter moviesAdapter;//电影适配器
private VideosBeans.MsgBodyBean.ListBean.VideosAllBean videoPaths;//电影播放路径。
private List<VideosBeans.MsgBodyBean.ListBean.VideosAllBean> listVideoJishu;//电影播放路径。
private List<VideosBeans.MsgBodyBean.ListBean> listVideos;//电影信息
public static int pageNo = 1;//电影页数
public static int typeID;//电影类型ID
private DianshiJvAdapter mJiShuAdapter;//电视剧 集数 适配器。
private int movieOrMusicType = 1;//默认 进来是电影,1 音乐是0
private List<MusicTypeBean.MsgBodyBean> mMusicTypes;// 音乐类型
private List<MusicBean.MsgBodyBean> mSongs;//每个类型下面的音乐
private MusicAdapter musicAdapter;//音乐
private MusicTypeAdapter musicTypeAdapter;//音乐
private int songPageNo = 1;//音乐。
private int currIndexMusic = 0;// 表示当前播放的音乐索引
private boolean flagMusic = true;//控制进度条线程标记
// 定义当前播放器的状态״̬
private static final int IDLE = 0;
private static final int PAUSE = 1;
private static final int START = 2;
private static final int CURR_TIME_VALUE = 1;
private int currStateMusic = IDLE; // 当前播放器的状态
//定义线程池(同时只能有一个线程运行)
ExecutorService esaa = Executors.newSingleThreadExecutor();
private MediaPlayer mp;//音乐
JZVideoPlayerStandard jzVideoPlayerStandard;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_movie);
ButterKnife.bind(this);
movieOrMusicType = getIntent().getIntExtra("mmid", 1);
//
if (movieOrMusicType == 0) {//音乐
getAllMusic();
initViewMusic();
} else {//电影
getAllVideos();
initViewMovie();
}
}
//初始化电影
private void initViewMovie() {
jzVideoPlayerStandard = findViewById(R.id.videoplayer);
LinearLayoutManager gridLayoutManager = new LinearLayoutManager(this);
movieTypeRl.setLayoutManager(gridLayoutManager);
//具体 电影
GridLayoutManager gridLayoutManagers = new GridLayoutManager(MoviesActivity.this, 6);
movieRv.setLayoutManager(gridLayoutManagers);
//
playMusicLl.setVisibility(View.GONE);
}
/**
* 电视剧适配器。、
*/
public void initDianshiJv(final List<VideosBeans.MsgBodyBean.ListBean.VideosAllBean> videoPath, final String path){
GridLayoutManager gridLayoutManagers = new GridLayoutManager(MoviesActivity.this, 7);
xqMovieJishuRc.setVisibility(View.VISIBLE);
xqMovieJishuRc.setLayoutManager(gridLayoutManagers);
mJiShuAdapter =new DianshiJvAdapter(videoPath,MoviesActivity.this);
xqMovieJishuRc.setAdapter(mJiShuAdapter);
}
/**
* 电影播放前。
*/
public void initMovePlay(String path,String name,String img){
jzVideoPlayerStandard.setVisibility(View.VISIBLE);
jzVideoPlayerStandard.setUp(path,JZVideoPlayerStandard.SCREEN_WINDOW_NORMAL, name);
Glide.with(MoviesActivity.this)
.load(img)
.into(jzVideoPlayerStandard.thumbImageView);
}
@OnClick({R.id.back_ll, R.id.zuixin_tv, R.id.zuire_tv, R.id.haoping_tv, R.id.left_iv, R.id.right_iv, R.id.music_play_shang, R.id.music_play_stop, R.id.music_play_next})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.back_ll:
if (movieXiangqingLl.getVisibility() == View.VISIBLE) {//不是显示的。 t
movieXiangqingLl.setVisibility(View.GONE);
movieLl.setVisibility(View.VISIBLE);
} else {//显示的话。
finish();
}
break;
case R.id.zuixin_tv:
break;
case R.id.zuire_tv:
break;
case R.id.haoping_tv:
break;
case R.id.left_iv:
if (pageNo == 1) {
} else {
pageNo--;
getVideos(listVideoType.get(typeID).getId(), pageNo);
}
yeshu.setText(pageNo + "");
break;
case R.id.right_iv:
if (listVideos.size() == 0) {
Toast.makeText(this, "没有更多数据!", Toast.LENGTH_SHORT).show();
} else {
pageNo++;
getVideos(listVideoType.get(typeID).getId(), pageNo);
yeshu.setText(pageNo + "");
}
break;
// case R.id.xq_play_tv: //立即播放按钮
// break;
case R.id.music_play_shang://上一首
previous();
break;
case R.id.music_play_stop://暂停播放
play();
break;
case R.id.music_play_next://下一首
next();
break;
}
}
/**
* 获取电影类型
*/
public void getAllVideos() {
OkGo.<String>get(URL.getAllVideos)
.tag(this)
.execute(new StringCallback() {
@Override
public void onSuccess(Response<String> listType) {
VideosTypeBean vyb = GsonUtils.GsonToBean(listType.body(), VideosTypeBean.class);
listVideoType = vyb.getMsgBody();
Log.e("路径--", listType.body() + URL.getAllVideos);
Config.sVideoTypeBean = vyb;
typeAdapter = new MovieTypeAdapter(listVideoType, MoviesActivity.this);
movieTypeRl.setAdapter(typeAdapter);
getVideos(listVideoType.get(0).getId(), pageNo);//默认查询第一个
//类型
typeAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
@Override
public void onItemClick(BaseQuickAdapter adapter, View view, final int position) {
pageNo = 1;
typeID = position;
getVideos(listVideoType.get(position).getId(), pageNo);
yeshu.setText(pageNo + "");
//点击事件
}
});
}
});
}
/**
* 获取类型下面的所有电影
* @param typeID 类型iD
* @param pageNo 页数
*/
public void getVideos(int typeID, int pageNo) {
Log.e("路径--类型下所有电影", getVideos + typeID + "&pageNo=" + pageNo + "&pageSize=" + 12);
OkGo.<String>get(getVideos + typeID + "&pageNo=" + pageNo + "&pageSize=" + 12)
.tag(this)
.execute(new StringCallback() {
@Override
public void onSuccess(Response<String> response) {
VideosBeans videosBean = GsonUtils.GsonToBean(response.body(), VideosBeans.class);
listVideos=videosBean.getMsgBody().getList();
if (listVideos.size() != 0) {
moviesAdapter = new MoviesAdapter(listVideos, MoviesActivity.this);
movieRv.setAdapter(moviesAdapter);
//查询类型下面的
moviesAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
@Override
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
//点击进入详情页
movieXiangqingLl.setVisibility(View.VISIBLE);
movieLl.setVisibility(View.GONE);
//设置详情页的数据。
setXiangQing(listVideos.get(position).getVoidprogramimg(),
listVideos.get(position).getVoidprogramname(),
listVideos.get(position).getVoidprogramdirector(),
listVideos.get(position).getVoidprogramstarring(),
listVideos.get(position).getFilmtype(),
listVideos.get(position).getArea(),
"242323",
listVideos.get(position).getVoidprogramdescription());
//播放路径。
listVideoJishu =listVideos.get(position).getVideos();
Log.e("o电视剧下面每一部 ",listVideoJishu.size()+"" );
//查找是否是连续剧
int types =listVideos.get(position).getTypes();//1 。
if (types==0){//电视剧
initDianshiJv(listVideoJishu,listVideoJishu.get(position).getVoidpath());
initMovePlay(listVideoJishu.get(position).getVoidpath(),
listVideos.get(position).getVoidprogramname(),
listVideos.get(position).getVoidprogramimg()
);
final String imgpath= listVideos.get(position).getVoidprogramimg();
mJiShuAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
@Override
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
//取出播放链接。跳转到播放页面
initMovePlay(listVideoJishu.get(position).getVoidpath(),
listVideoJishu.get(position).getVoidname(),
imgpath
);
}
});
}else{//电影
xqMovieJishuRc.setVisibility(View.GONE);
String path=listVideoJishu.get(0).getVoidpath();
initMovePlay(path,listVideos.get(position).getVoidprogramname(),
listVideos.get(position).getVoidprogramimg()
);
}
}
});
} else {
Toast.makeText(MoviesActivity.this, "没有更多数据", Toast.LENGTH_SHORT).show();
}
}
});
}
/**
* 设置详情
*
* @param name
* @param zhuyan
* @param daoyan
* @param type
* @param addr
* @param Num
* @param jianjie
*/
public void setXiangQing(String path, String name, String zhuyan, String daoyan, String type, String addr, String Num, String jianjie) {
Glide.with(MoviesActivity.this)
.load(path)
.into(xqMovieIv);
xqMovieNameTv.setText(name); //名称
xqMovieZhuyanTv.setText("主演:" + zhuyan); //主演
xqMovieDaoyanTv.setText("导演:" + daoyan); //导演
xqMovieTypeTv.setText("类型:" + type); //电影类型
xqMovieAddrTv.setText("制片国家:" + addr); //地址
xqMoviePaleyNumTv.setText("播放次数:" + Num); //播放次数
// xqMovieJishuRc;//每一集
xqMovieJianjieTv.setText(jianjie); // 介绍
}
//初始化 音乐
private void initViewMusic() {
LinearLayoutManager gridLayoutManager = new LinearLayoutManager(this);
movieTypeRl.setLayoutManager(gridLayoutManager);
GridLayoutManager gridLayoutManagers = new GridLayoutManager(MoviesActivity.this, 6);
movieRv.setLayoutManager(gridLayoutManagers);
LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) heiLl.getLayoutParams();
params.height = 590;
heiLl.setLayoutParams(params);
fanyeLl.setVisibility(View.GONE);
playMusicLl.setVisibility(View.VISIBLE);
mp = new MediaPlayer();
mp.setOnCompletionListener(this);
mp.setOnErrorListener(this);
}
/**
* 查询 所有音乐 包括 类型下面的数据。
*/
public void getAllMusic() {
OkGo.<String>get(URL.getCategorySongs)
.tag(this)
.execute(new StringCallback() {
@Override
public void onSuccess(Response<String> listType) {
MusicTypeBean mb = GsonUtils.GsonToBean(listType.body(), MusicTypeBean.class);
mMusicTypes = mb.getMsgBody();
//类型适配器
musicTypeAdapter = new MusicTypeAdapter(mMusicTypes, MoviesActivity.this);
movieTypeRl.setAdapter(musicTypeAdapter);
getAllSongs(mMusicTypes.get(0).getId(), songPageNo, 20);
musicTypeAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
@Override
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
getAllSongs(mMusicTypes.get(position).getId(), songPageNo, 20);
//类型下面的音乐
}
});
}
});
}
//&vodPartId=10&pageNo=2&pageSize=20
public void getAllSongs(int typeID, int songPageNo, int songSize) {
// OkGo.<String>get(URL.getAllSongs+"&vodPartId"+typeID+"pageNo"+songPageNo+"pageSize"+songSize)
OkGo.<String>get(URL.getAllSongs)
.tag(this)
.execute(new StringCallback() {
@Override
public void onSuccess(Response<String> response) {
Log.e("onSuccess音乐: .", response.body());
MusicBean musicBean = GsonUtils.GsonToBean(response.body(), MusicBean.class);
mSongs = musicBean.getMsgBody();
if (mSongs.size() == 0) {
} else {
musicAdapter = new MusicAdapter(mSongs, MoviesActivity.this);
movieRv.setAdapter(musicAdapter);
Log.e("onSuccess音乐: .", mSongs.get(0).getSongName());
musicAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
@Override
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
currIndexMusic = position;//当前音乐点击的索引
start();
Glide.with(MoviesActivity.this).
load(mSongs.get(position).getLogo())
.into(musicPlayImg);
}
});
}
}
});
}
@Override
public void onCompletion(MediaPlayer mp) {//监听播放完成。自动播放下一首。
if (mSongs.size() > 0) {
next();
} else {
Toast.makeText(this, "播放列表为空", Toast.LENGTH_SHORT).show();
}
}
@Override
public boolean onError(MediaPlayer mp, int what, int extra) {
mp.reset();
return false;
}
@Override
protected void onDestroy() {//关闭音乐
if (mp != null) {
flagMusic = false;
try {
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
//释放资源
mp.release();
// mp.stop();
// mp.pause();
if (mp != null) {
mp = null;
}
}
super.onDestroy();
}
//上一首
private void previous() {
if ((currIndexMusic - 1) >= 0) {
currIndexMusic--;
start();
} else {
Toast.makeText(this, "当前已经是第一首歌曲了", Toast.LENGTH_SHORT).show();
}
}
//下一自首
private void next() {
if (currIndexMusic + 1 < mSongs.size()) {
currIndexMusic++;
start();
} else {
Toast.makeText(this, "当前已经是最后一首歌曲了", Toast.LENGTH_SHORT).show();
}
}
//开始播放
private void start() {
if (mSongs.size() > 0 && currIndexMusic < mSongs.size()) {
String SongPath = mSongs.get(currIndexMusic).getMusicFile();
mp.reset();
try {
mp.setDataSource(SongPath);
mp.prepare();
mp.start();
initSeekBar();
esaa.execute(this);
currStateMusic = PAUSE;
//中文
musicInfoTv
.setText(mSongs.get(currIndexMusic).getSongName() + "-" +
mSongs.get(currIndexMusic).getSinger());
musicPlayTimesTv.setText("/" + toTime(mp.getDuration()));//播放总时长
Glide.with(this)
.load(R.drawable.ic_play)
.into(musicPlayStop);
} catch (IOException e) {
e.printStackTrace();
}
} else {
Toast.makeText(this, "播放列表为空", Toast.LENGTH_SHORT).show();
}
}
//初始化SeekBar
private void initSeekBar() {
musicPlaySb.setMax(mp.getDuration());
musicPlaySb.setProgress(0);
musicPlayTimeTv.setText(toTime(mp.getDuration()));
musicPlaySb.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
//是否由用户改变
if (fromUser) {
mp.seekTo(progress);
}
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
});
}
private String toTime(int time) {
int minute = time / 1000 / 60;
int s = time / 1000 % 60;
String mm = null;
String ss = null;
if (minute < 10) mm = "0" + minute;
else mm = minute + "";
if (s < 10) ss = "0" + s;
else ss = "" + s;
return mm + ":" + ss;
}
private void play() {
switch (currStateMusic) {
case IDLE:
start();
currStateMusic = PAUSE;
break;
case PAUSE:
mp.pause();
Glide.with(this)
.load(R.drawable.ic_play_n)
.into(musicPlayStop);
currStateMusic = START;
break;
case START:
mp.start();
Glide.with(this)
.load(R.drawable.ic_play)
.into(musicPlayStop);
currStateMusic = PAUSE;
}
}
private Handler hander = new Handler() {
public void handleMessage(android.os.Message msg) {
switch (msg.what) {
case CURR_TIME_VALUE:
//设置当前时间
musicPlayTimeTv.setText(msg.obj.toString());
break;
default:
break;
}
}
};
public void run() {
flagMusic = true;
while (flagMusic) {
if (null!=mp){
if (mp.getCurrentPosition() < musicPlaySb.getMax()) {
musicPlaySb.setProgress(mp.getCurrentPosition());
Message msg = hander.obtainMessage(CURR_TIME_VALUE, toTime(mp.getCurrentPosition()));
hander.sendMessage(msg);
try {
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}else {
flagMusic = false;
}
}
}
@Override
public void onBackPressed() {
if (JZVideoPlayer.backPress()) {
return;
}
super.onBackPressed();
}
@Override
protected void onPause() {
super.onPause();
JZVideoPlayer.releaseAllVideos();
}
@Override
public void onClick(View v) {
}
}
XML页面
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/ic_bg"
android:orientation="vertical">
<spa.nabo.com.nabospa.view.title
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</spa.nabo.com.nabospa.view.title>
<include layout="@layout/back" />
<LinearLayout
android:id="@+id/movie_ll"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:visibility="visible">
<android.support.v7.widget.RecyclerView
android:id="@+id/movie_type_rl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="7">
</android.support.v7.widget.RecyclerView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:clipChildren="true"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:orientation="horizontal">
<TextView
android:id="@+id/zuixin_tv"
android:layout_width="100dp"
android:layout_height="50dp"
android:clickable="true"
android:focusable="true"
android:gravity="center"
android:text="最新"
android:textColor="@drawable/movies_type_select_font_heibai"
android:textSize="18sp" />
<TextView
android:id="@+id/zuire_tv"
android:layout_width="100dp"
android:layout_height="50dp"
android:layout_toRightOf="@id/zuixin_tv"
android:focusable="true"
android:gravity="center"
android:text="最热"
android:textColor="@drawable/movies_type_select_font_heibai"
android:textSize="18sp" />
<TextView
android:id="@+id/haoping_tv"
android:layout_width="100dp"
android:layout_height="50dp"
android:layout_toRightOf="@id/zuire_tv"
android:focusable="true"
android:gravity="center"
android:text="好评"
android:textColor="@drawable/movies_type_select_font_heibai"
android:textSize="18sp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_alignParentRight="true"
android:layout_marginRight="50dp"
android:gravity="center"
android:orientation="horizontal"
android:paddingRight="20dp">
<TextView
android:layout_width="200dp"
android:layout_height="40dp"
android:background="@drawable/text_boder_bai"
android:drawableRight="@drawable/sousuo_ic"
android:gravity="center|left"
android:hint="搜索"
android:padding="5dp"
android:textColorHint="@color/ziti_hint_font" />
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:id="@+id/hei_ll"
android:layout_width="match_parent"
android:layout_height="510dp">
<android.support.v7.widget.RecyclerView
android:id="@+id/movie_rv"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
</android.support.v7.widget.RecyclerView>
</LinearLayout>
<LinearLayout
android:id="@+id/fanye_ll"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:gravity="center"
android:orientation="horizontal">
<ImageView
android:id="@+id/left_iv"
android:layout_width="40dp"
android:layout_height="40dp"
android:focusable="true"
android:src="@drawable/left_select" />
<TextView
android:id="@+id/yeshu"
android:layout_width="40dp"
android:layout_height="wrap_content"
android:gravity="center"
android:text="1"
android:textColor="@color/font_baise_color"
android:textSize="18sp" />
<ImageView
android:id="@+id/right_iv"
android:layout_width="40dp"
android:layout_height="40dp"
android:focusable="true"
android:src="@drawable/right_select" />
</LinearLayout>
<!--播放控件-->
<LinearLayout
android:id="@+id/play_music_ll"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="bottom"
android:gravity="bottom">
<include
android:id="@+id/play_ll"
layout="@layout/music_play" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<RelativeLayout
android:id="@+id/movie_xiangqing_ll"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone"
android:padding="5dp"
>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:orientation="vertical"
android:id="@+id/linearLayout3">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal">
<ImageView
android:id="@+id/xq_movie_iv"
android:layout_width="220dp"
android:layout_height="270dp"
android:src="@color/font_baise_color" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:orientation="vertical">
<TextView
android:id="@+id/xq_movie_name_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="24小时:末日重生 24Hours To Live(2017)"
android:textColor="@color/ziti_font"
android:textSize="18sp" />
<TextView
android:id="@+id/xq_movie_zhuyan_tv"
android:layout_width="350dp"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:ellipsize="end"
android:lineSpacingExtra="10dp"
android:maxLines="2"
android:text="主演: 泰伊·谢里丹 / 奥利维亚·库克 / 本·门德尔森 / 马克·里朗斯 / 丽娜·维特 / 森崎温 / 赵家正 / 西蒙·佩吉 / T·J·米勒 / 汉娜·乔恩-卡门 / 拉尔夫·尹爱森 / 苏珊·林奇 / 克莱尔·希金斯 / 劳伦斯·斯佩尔曼 / 佩蒂塔·维克斯 / 艾萨克·安德鲁斯"
android:textColor="@color/ziti_font"
android:textSize="18sp" />
<TextView
android:id="@+id/xq_movie_daoyan_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="导演: 史蒂文·斯皮尔伯"
android:textColor="@color/ziti_font"
android:textSize="18sp" />
<TextView
android:layout_width="wrap_content"
android:id="@+id/xq_movie_type_tv"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="类型: 动作 / 科幻 / 冒险"
android:textColor="@color/ziti_font"
android:textSize="18sp" />
<TextView
android:id="@+id/xq_movie_addr_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="制片国家/地区: 美国"
android:textColor="@color/ziti_font"
android:textSize="18sp" />
<TextView
android:id="@+id/xq_movie_paleyNum_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="播放次数:3892次"
android:textColor="@color/ziti_font"
android:textSize="18sp" />
</LinearLayout>
</LinearLayout>
<TextView
android:layout_marginTop="30dp"
android:id="@+id/xq_movie_jianjie_tv"
android:layout_width="595dp"
android:layout_height="wrap_content"
android:ellipsize="end"
android:lineSpacingExtra="10dp"
android:maxLines="3"
android:text="在2045年,现实世界衰退破败,人们沉迷于VR(虚拟现实)游戏“绿洲(OASIS)”的虚幻世界里寻求慰藉。马克·里朗斯饰演的“绿洲”的创始人临终前宣布,将亿万身家全部留给寻获他隐藏的彩蛋的游戏玩家,史上最大规模的寻宝冒险就此展开,由泰伊·谢里丹饰演的男主角韦德·沃兹(Wade Watts/Parzival)和数十亿竞争者踏上奇妙而又危机重重的旅途。"
android:textColor="@color/ziti_font"
android:textSize="18sp"
/>
</LinearLayout>
<LinearLayout
android:layout_toRightOf="@+id/linearLayout3"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_alignParentRight="true"
android:layout_height="wrap_content">
<cn.jzvd.JZVideoPlayerStandard
android:focusable="true"
android:id="@+id/videoplayer"
android:layout_width="match_parent"
android:layout_height="300dp"/>
<!--电影-->
<android.support.v7.widget.RecyclerView
android:visibility="gone"
android:id="@+id/xq_movie_jishu_rc"
android:layout_width="match_parent"
android:layout_height="250dp">
</android.support.v7.widget.RecyclerView>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
期待大神们的指点。
简单做个笔记。方便自己方便他人