import java.util.List;
import bean.MyBean;
/**
* 类的用途:
* 实现思路:
* 时间:2017/11/18
* 作者:董金金
*/
public interface MyView {
void getIn(List<MyBean.DataBean> data);
}
package utils;
import android.content.Intent;
import android.net.Uri;
import android.os.Environment;
import android.util.Log;
import android.widget.Toast;
import com.baway.admin.zhoukaothreelianxi.MainActivity;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import okhttp3.Cache;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.FormBody;
import okhttp3.MediaType;
import okhttp3.MultipartBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
/**
* 1. 类的用途 封装OkHttp3的工具类 用单例设计模式
* 2. @author forever
* 3. @date 2017/9/6 09:19
*/
public class OkHttp3Utils {
/**
* 懒汉 安全 加同步
* 私有的静态成员变量 只声明不创建
* 私有的构造方法
* 提供返回实例的静态方法
*/
private static OkHttpClient okHttpClient = null;
public OkHttp3Utils() {
}
public static OkHttpClient getInstance() {
if (okHttpClient == null) {
//加同步安全
synchronized (OkHttp3Utils.class) {
if (okHttpClient == null) {
//判空 为空创建实例
// okHttpClient = new OkHttpClient();
/**
* 和OkHttp2.x有区别的是不能通过OkHttpClient直接设置超时时间和缓存了,而是通过OkHttpClient.Builder来设置,
* 通过builder配置好OkHttpClient后用builder.build()来返回OkHttpClient,
* 所以我们通常不会调用new OkHttpClient()来得到OkHttpClient,而是通过builder.build():
*/
// File sdcache = getExternalCacheDir();
File sdcache = new File(Environment.getExternalStorageDirectory(), "cache");
int cacheSize = 10 * 1024 * 1024;
okHttpClient = new OkHttpClient.Builder().connectTimeout(15, TimeUnit.SECONDS)
.writeTimeout(20, TimeUnit.SECONDS).readTimeout(20, TimeUnit.SECONDS).cache(new Cache(sdcache.getAbsoluteFile(), cacheSize)).build();
}
}
}
return okHttpClient;
}
/**
* get请求
* 参数1 url
* 参数2 回调Callback
*/
public static void doGet(String url, Callback callback) {
//创建OkHttpClient请求对象
OkHttpClient okHttpClient = getInstance();
//创建Request
Request request = new Request.Builder().url(url).build();
//得到Call对象
Call call = okHttpClient.newCall(request);
//执行异步请求
call.enqueue(callback);
}
/**
* post请求
* 参数1 url
* 参数2 回调Callback
*/
public static void doPost(String url, Map<String, String> params, Callback callback) {
//创建OkHttpClient请求对象
OkHttpClient okHttpClient = getInstance();
//3.x版本post请求换成FormBody 封装键值对参数
FormBody.Builder builder = new FormBody.Builder();
//遍历集合
for (String key : params.keySet()) {
builder.add(key, params.get(key));
}
//创建Request
Request request = new Request.Builder().url(url).post(builder.build()).build();
Call call = okHttpClient.newCall(request);
call.enqueue(callback);
}
/**
* post请求上传文件
* 参数1 url
* 参数2 回调Callback
*/
public static void uploadPic(String url, File file, String fileName) {
//创建OkHttpClient请求对象
OkHttpClient okHttpClient = getInstance();
//创建RequestBody 封装file参数
RequestBody fileBody = RequestBody.create(MediaType.parse("application/octet-stream"), file);
//创建RequestBody 设置类型等
RequestBody requestBody = new MultipartBody.Builder().setType(MultipartBody.FORM).addFormDataPart("file", fileName, fileBody).build();
//创建Request
Request request = new Request.Builder().url(url).post(requestBody).build();
//得到Call
Call call = okHttpClient.newCall(request);
//执行请求
call.enqueue(new Callback() {
@Override
public void onFailure(Call call, IOException e) {
}
@Override
public void onResponse(Call call, Response response) throws IOException {
//上传成功回调 目前不需要处理
}
});
}
/**
* Post请求发送JSON数据
* 参数一:请求Url
* 参数二:请求的JSON
* 参数三:请求回调
*/
public static void doPostJson(String url, String jsonParams, Callback callback) {
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), jsonParams);
Request request = new Request.Builder().url(url).post(requestBody).build();
Call call = getInstance().newCall(request);
call.enqueue(callback);
}
/**
* 下载文件 以流的形式把apk写入的指定文件 得到file后进行安装
* 参数一:请求Url
* 参数二:保存文件的路径名
* 参数三:保存文件的文件名
*/
public static void download(final MainActivity context, final String url, final String saveDir) {
Request request = new Request.Builder().url(url).build();
Call call = getInstance().newCall(request);
call.enqueue(new Callback() {
@Override
public void onFailure(Call call, IOException e) {
Log.i("xxx", e.toString());
}
@Override
public void onResponse(Call call, final Response response) throws IOException {
InputStream is = null;
byte[] buf = new byte[2048];
int len = 0;
FileOutputStream fos = null;
try {
is = response.body().byteStream();
//apk保存路径
final String fileDir = isExistDir(saveDir);
//文件
File file = new File(fileDir, getNameFromUrl(url));
context.runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(context, "下载成功:" + fileDir + "," + getNameFromUrl(url), Toast.LENGTH_SHORT).show();
}
});
fos = new FileOutputStream(file);
while ((len = is.read(buf)) != -1) {
fos.write(buf, 0, len);
}
fos.flush();
//apk下载完成后 调用系统的安装方法
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive");
context.startActivity(intent);
} catch (IOException e) {
e.printStackTrace();
} finally {
if (is != null) is.close();
if (fos != null) fos.close();
}
}
});
}
/**
* @param saveDir
* @return
* @throws IOException 判断下载目录是否存在
*/
public static String isExistDir(String saveDir) throws IOException {
// 下载位置
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
File downloadFile = new File(Environment.getExternalStorageDirectory(), saveDir);
if (!downloadFile.mkdirs()) {
downloadFile.createNewFile();
}
String savePath = downloadFile.getAbsolutePath();
Log.e("savePath", savePath);
return savePath;
}
return null;
}
/**
* @param url
* @return 从下载连接中解析出文件名
*/
private static String getNameFromUrl(String url) {
return url.substring(url.lastIndexOf("/") + 1);
}
}
//
package utils;
import bean.MyBean;
import retrofit2.Call;
import retrofit2.http.GET;
/**
* 类的用途:
* 实现思路:
* 时间:2017/11/18
* 作者:董金金
*/
public interface MyInterface {
@GET("iYXEPGn4e9c6dafce6e5cdd23287d2bb136ee7e9194d3e9?uri=vedio")
Call<MyBean> getCall();
}
//
package utils;
import android.content.Context;
import android.content.Intent;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.View;
import android.widget.Toast;
import com.baway.admin.zhoukaothreelianxi.HomeActivity;
import com.baway.admin.zhoukaothreelianxi.R;
/**
* 类的用途:
* 实现思路:
* 时间:2017/11/18
* 作者:董金金
*/
public class MyCircleView extends View {
//当前画笔画圆的颜色
private int CurrenCircleBoundColor;
private Paint paint;
从xml中获取的颜色
private int circleBundColor;
private float circleBoundWidth;
private float pivotX;
private float pivotY;
private float radius=130;
private float currentDegree=0;
private int currentSpeed=1;
private boolean isPause=false;
public MyCircleView(Context context) {
super(context);
initView(context);
}
public MyCircleView(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
initView(context);
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.MyCustomCircleArrowView);
for (int i = 0; i < typedArray.getIndexCount(); i++) {
//就是我们自定义的属性的资源id
int attr = typedArray.getIndex(i);
switch (attr){
case R.styleable.MyCustomCircleArrowView_circlr_bound_color:
circleBundColor = typedArray.getColor(attr, Color.RED);
CurrenCircleBoundColor=circleBundColor;
break;
case R.styleable.MyCustomCircleArrowView_circlr_bound_width:
circleBoundWidth = typedArray.getDimension(attr, 3);
break;
}
}
}
public MyCircleView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
initView(context);
}
private void initView(Context context){
paint = new Paint();
}
public void setColor(int color){
if (CurrenCircleBoundColor!=color){
CurrenCircleBoundColor=color;
}else {
CurrenCircleBoundColor=circleBundColor;
}
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
paint.setAntiAlias(true);
paint.setColor(CurrenCircleBoundColor);
paint.setStrokeWidth(circleBoundWidth);
paint.setStyle(Paint.Style.STROKE);
pivotX = getWidth() / 2;
pivotY = getHeight() / 2;
canvas.drawCircle(pivotX,pivotY,radius,paint);
canvas.save();
//旋转画布 , 如果旋转的的度数大的话,视觉上看着是旋转快的
canvas.rotate(currentDegree,pivotX,pivotY);
//提供了一些api可以用来画线(画路径)
Path path = new Path();
//从哪开始画 从A开始画
path.moveTo(pivotX+radius,pivotY);
//从A点画一个直线到D点
path.lineTo(pivotX+radius-20,pivotY-20);
//从D点画一个直线到B点
path.lineTo(pivotX+radius,pivotY+20);
//从B点画一个直线到C点
path.lineTo(pivotX+radius+20,pivotY-20);
//闭合 -- 从C点画一个直线到A点
path.close();
paint.setStyle(Paint.Style.FILL);
paint.setColor(Color.BLACK);
canvas.drawPath(path,paint);
canvas.restore();
//旋转的度数一个一个度数增加, 如果乘以一个速度的话,按一个速度速度增加
currentDegree+=1*currentSpeed;
if (!isPause){
invalidate();
}
}
public void speed(){
++currentSpeed;
if (currentSpeed>=10){
currentSpeed=10;
Toast.makeText(getContext(),"我比闪电还快",Toast.LENGTH_SHORT).show();
}else if(currentSpeed==8){
Intent intent=new Intent(getContext(), HomeActivity.class);
getContext().startActivity(intent);
}
}
public void slowDown(){
--currentSpeed;
if (currentSpeed<=1){
currentSpeed=1;
}
}
public void pauseOrStart(){
//如果是开始状态的话去重新绘制
if (isPause){
isPause=!isPause;
invalidate();
}else {
isPause=!isPause;
}
}
}
//
package presenter;
import android.content.Context;
import java.util.List;
import bean.MyBean;
import model.MyModel;
import view.MyView;
/**
* 类的用途:
* 实现思路:
* 时间:2017/11/18
* 作者:董金金
*/
public class MyPresenter implements MyModel.GetIn {
private Context context;
private MyView myView;
private final MyModel myModel;
public MyPresenter(Context context, MyView myView) {
this.context = context;
this.myView = myView;
myModel = new MyModel();
myModel.setGetIn(this);
}
public void QQ(){
myModel.getData();
}
@Override
public void getIn(List<MyBean.DataBean> data) {
myView.getIn(data);
}
}
/
package model;
import java.util.List;
import bean.MyBean;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
import utils.MyInterface;
/**
* 类的用途:
* 实现思路:
* 时间:2017/11/18
* 作者:董金金
*/
public class MyModel {
private GetIn getIn;
private String image_url;
public void setGetIn(GetIn getIn) {
this.getIn = getIn;
}
public void getData(){
Retrofit retrofit = new Retrofit.Builder()
.baseUrl("http://result.eolinker.com/") //设置网络请求的Url地址
.addConverterFactory(GsonConverterFactory.create()) //设置数据解析器
.build();
MyInterface request = retrofit.create(MyInterface.class);
Call<MyBean> call = request.getCall();
call.enqueue(new Callback<MyBean>() {
@Override
public void onResponse(Call<MyBean> call, Response<MyBean> response) {
// if(response.isSuccessful()){
List<MyBean.DataBean> data = response.body().getData();
System.out.println("====data=="+data.size());
getIn.getIn(data);
// }
}
@Override
public void onFailure(Call<MyBean> call, Throwable t) {
System.out.println("======连接失败======");
}
});
}
public interface GetIn{
void getIn(List<MyBean.DataBean> data);
}
}
/
package com.baway.admin.zhoukaothreelianxi;
import android.graphics.Color;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import utils.MyCircleView;
public class MainActivity extends AppCompatActivity{
//全局变量
private MyCircleView my_view;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//找控件
my_view = (MyCircleView) findViewById(R.id.my_view);
}
public void onClick(View view){
my_view.setColor(Color.BLUE);
}
public void add(View view){
my_view.speed();
}
public void slow(View view){
my_view.slowDown();
}
public void pauseOrStart(View view){
my_view.pauseOrStart();
}
}
///
package com.baway.admin.zhoukaothreelianxi;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;
import com.bumptech.glide.Glide;
import com.stx.xhb.xbanner.XBanner;
import com.stx.xhb.xbanner.transformers.Transformer;
import java.util.List;
import adapter.MyAdapter;
import bean.MyBean;
import presenter.MyPresenter;
import view.MyView;
public class HomeActivity extends AppCompatActivity implements MyView {
private XBanner xb;
private RecyclerView rv;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);
//获取控件信息
initView();
//实例化p层
MyPresenter myPresenter=new MyPresenter(this,this);
myPresenter.QQ();
}
private void initView() {
xb = (XBanner) findViewById(R.id.xb);
rv = (RecyclerView) findViewById(R.id.rv);
}
@Override
protected void onResume() {
super.onResume();
xb.startAutoPlay();
}
@Override
protected void onStop() {
super.onStop();
xb.stopAutoPlay();
}
@Override
public void getIn(final List<MyBean.DataBean> data) {
if(this!=null){
// if(HomeActivity.this instanceof Activity){
runOnUiThread(new Runnable() {
@Override
public void run() {
GridLayoutManager manager=new GridLayoutManager(HomeActivity.this,1);
rv.setLayoutManager(manager);
MyAdapter myAdapter=new MyAdapter(HomeActivity.this,data);
System.out.println("=========走这儿了没?==========");
System.out.println("========data=========="+data.toString());
rv.setAdapter(myAdapter);
}
});
// }
}
// 为XBanner绑定数据
xb.setData(data,null);
// XBanner适配数据
xb.setmAdapter(new XBanner.XBannerAdapter() {
@Override
public void loadBanner(XBanner banner, View view, int position) {
Glide.with(HomeActivity.this).load(data.get(position).getImage_url()).into((ImageView) view);
System.out.println("======image_url========="+data.get(position).getImage_url());
}
});
// 设置XBanner的页面切换特效
xb.setPageTransformer(Transformer.Accordion);
// 设置XBanner页面切换的时间,即动画时长
xb.setPageChangeDuration(200);
}
}
----------------------------------------------------------------
package adapter;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.baway.admin.zhoukaothreelianxi.R;
import com.bumptech.glide.Glide;
import java.util.List;
import bean.MyBean;
import fm.jiecao.jcvideoplayer_lib.JCVideoPlayer;
import fm.jiecao.jcvideoplayer_lib.JCVideoPlayerStandard;
/**
* 类的用途:
* 实现思路:
* 时间:2017/11/18
* 作者:董金金
*/
public class MyAdapter extends RecyclerView.Adapter<MyAdapter.MyViewHolder> {
private Context context;
private List<MyBean.DataBean> data;
private TextView tt;
private TextView ct;
//private ImageView img;
private JCVideoPlayerStandard player;
public MyAdapter(Context context, List<MyBean.DataBean> data) {
this.context = context;
this.data = data;
}
@Override
public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view=View.inflate(context, R.layout.item,null);
MyViewHolder holder=new MyViewHolder(view);
return holder;
}
@Override
public void onBindViewHolder(MyViewHolder holder, int position) {
boolean setUp = player.setUp(data.get(position).getVedio_url(), JCVideoPlayer.SCREEN_LAYOUT_NORMAL, "");
if (setUp) {
Glide.with(context).load(data.get(position).getVedio_url()).into(player.thumbImageView);
}
//Glide.with(context).load(data.get(position).getImage_url()).into(img);
//System.out.println("=========img========="+img);
tt.setText(data.get(position).getTitle());
System.out.println("=======title======="+data.get(position).getTitle());
ct.setText(data.get(position).getContent());
System.out.println("========content========="+data.get(position).getContent());
System.out.println("======data1111========"+data);
//直接进入全屏
//player.startFullscreen(this, JCVideoPlayerStandard.class,, "");
//模拟用户点击开始按钮,NORMAL状态下点击开始播放视频,播放中点击暂停视频
//player.startButton.performClick();
}
@Override
public int getItemCount() {
if(data!=null){
return data.size();
}
return data.size();
}
public class MyViewHolder extends RecyclerView.ViewHolder{
public MyViewHolder(View itemView) {
super(itemView);
//img = itemView.findViewById(R.id.img);
tt=itemView.findViewById(R.id.tt);
ct = itemView.findViewById(R.id.ct);
player =itemView.findViewById(R.id.player_list_video);
}
}
}
/*-*/*-*/*-*/*/*-*/*-*/*-
package utils; import bean.MyBean; import retrofit2.Call; import retrofit2.http.GET; /** * 类的用途: * 实现思路: * 时间:2017/11/18 * 作者:董金金 */ public interface MyInterface { @GET("iYXEPGn4e9c6dafce6e5cdd23287d2bb136ee7e9194d3e9?uri=vedio") Call<MyBean> getCall(); }
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.baway.admin.zhoukaothreelianxi"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
//XBanner的依赖
compile 'com.xhb:xbanner:1.2.2'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'jp.wasabeef:glide-transformations:1.0.6'
//recyclerview的依赖
compile 'com.android.support:recyclerview-v7:26.0.0-alpha1'
// Retrofit库
compile 'com.squareup.retrofit2:retrofit:2.0.2'
// Okhttp库
compile 'com.squareup.okhttp3:okhttp:3.1.2'
//okhttp依赖
compile 'com.squareup.okhttp3:okhttp:3.9.0'
compile 'com.squareup.okio:okio:1.13.0'
//retrofit2依赖
compile 'com.squareup.retrofit2:converter-gson:2.0.2'
compile 'fm.jiecao:jiecaovideoplayer:4.8.3'
compile 'com.github.bumptech.glide:glide:3.7.0'
}
-------------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.baway.admin.zhoukaothreelianxi">
<!--联网权限-->
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".HomeActivity"></activity>
</application>
</manifest>
---------------------------------------------------------------------
<?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:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.baway.admin.zhoukaothreelianxi.HomeActivity">
<com.stx.xhb.xbanner.XBanner
android:id="@+id/xb"
android:layout_width="match_parent"
android:layout_height="150dp"></com.stx.xhb.xbanner.XBanner>
<android.support.v7.widget.RecyclerView
android:id="@+id/rv"
android:layout_width="match_parent"
android:layout_height="match_parent"></android.support.v7.widget.RecyclerView>
</LinearLayout>
------------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.baway.admin.zhoukaothreelianxi.MainActivity">
<Button
android:id="@+id/set_color_btn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:onClick="onClick"
android:text="设置颜色" />
<Button
android:id="@+id/add"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/set_color_btn"
android:layout_centerHorizontal="true"
android:onClick="add"
android:text="加速" />
<Button
android:id="@+id/slow"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/add"
android:layout_centerHorizontal="true"
android:onClick="slow"
android:text="减速" />
<Button
android:id="@+id/pause_or_start"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/slow"
android:layout_centerHorizontal="true"
android:onClick="pauseOrStart"
android:text="暂定/开始" />
<utils.MyCircleView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/my_view"
android:layout_centerInParent="true"
app:circlr_bound_color="@color/colorAccent"
app:circlr_bound_width="3dp" />
</RelativeLayout>
--------------------------------------------------------------------
<?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">
<fm.jiecao.jcvideoplayer_lib.JCVideoPlayerStandard
android:id="@+id/player_list_video"
android:layout_width="150dp"
android:layout_height="150dp" />
<!--<ImageView-->
<!--android:id="@+id/img"-->
<!--android:layout_width="150dp"-->
<!--android:layout_height="150dp" />-->
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/tt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="50dp"
android:text="标题"
android:textSize="30sp" />
<TextView
android:id="@+id/ct"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="内容"/>
</LinearLayout>
</LinearLayout>