91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

cc_美團 評論使用GitHut水平條開源項目事項

發布時間:2020-06-15 09:53:29 來源:網絡 閱讀:749 作者:愚人cc 欄目:移動開發

cc_美團 評論使用GitHut水平條開源項目事項


package com.chencheng.meituan.view;


import java.util.ArrayList;

import java.util.List;

import com.android.volley.VolleyError;

import com.chencheng.meituan.util.MeituanConstants;

import com.chencheng.model.detail.XComment;

import com.chencheng.model.detail.XItem;

import com.chencheng.model.detail.Xiangqing;

import com.github.mikephil.charting.charts.HorizontalBarChart;

import com.github.mikephil.charting.data.BarData;

import com.github.mikephil.charting.data.BarDataSet;

import com.github.mikephil.charting.data.BarEntry;

import com.github.mikephil.charting.utils.Legend;

import com.github.mikephil.charting.utils.Legend.LegendPosition;

import com.github.mikephil.charting.utils.XLabels;

import com.github.mikephil.charting.utils.XLabels.XLabelPosition;

import com.github.mikephil.charting.utils.YLabels;

import com.github.mikephil.charting.utils.YLabels.YLabelPosition;

import com.github.volley.MyVolley;

import com.github.volley.VolleyListener;

import com.xinbo.utils.GsonUtils;

import com.xinbo.widget.ListView4ScrollView;

import com.yuchen.meituan.R;

import com.yuchen.meituan.R.id;

import com.yuchen.meituan.R.layout;

import com.yuchen.meituan.R.menu;


import android.app.Activity;

import android.graphics.Color;

import android.os.Bundle;

import android.provider.SyncStateContract.Constants;

import android.view.Menu;

import android.view.MenuItem;

import android.view.View;

import android.view.View.OnClickListener;

import android.view.ViewGroup;

import android.widget.BaseAdapter;

import android.widget.TextView;


public class CommentActivity extends Activity implements OnClickListener {


protected String[] mLevels = new String[] { "1星", "2星", "3星", "4星", "5星", };

private List<XItem> mCommetnList = new ArrayList<XItem>();

private HorizontalBarChart mChart;

private MyListAdapter mAdapter;


@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_comment);

initUI();

initChart();

getJson();

}

private void getJson() {

MyVolley.get(this, MeituanConstants.UrlPath.XIANGQING, new VolleyListener() {

@Override

public void onErrorResponse(VolleyError arg0) {

arg0.getMessage();

}


@Override

public void onResponse(String arg0) {

parseJson(arg0);

}

});

}


protected void parseJson(String arg0) {

Xiangqing xiangqingInfo = GsonUtils.parseJSON(arg0, Xiangqing.class);

XComment comment = xiangqingInfo.getComment();

mCommetnList.addAll(comment.getItems());

mAdapter.notifyDataSetChanged();

}

private void initUI() {

findViewById(R.id.back_btn).setOnClickListener(this);

ListView4ScrollView mListView = (ListView4ScrollView) findViewById(R.id.listView1);

mAdapter = new MyListAdapter();

mListView.setAdapter(mAdapter);

}


class MyListAdapter extends BaseAdapter{


@Override

public View getView(int position, View convertView, ViewGroup parent) {

XItem item = mCommetnList.get(position);

View view = getLayoutInflater().inflate(

R.layout.listview_comment_item, null);

TextView tvUser = (TextView) view.findViewById(R.id.tv_user);

TextView tvTime = (TextView) view.findViewById(R.id.tv_time);

TextView tvContent = (TextView) view.findViewById(R.id.tv_content);

tvUser.setText(item.getUser_id());

tvTime.setText(item.getAdd_time());

tvContent.setText(item.getContent());

return view;

}

@Override

public int getCount() {

// TODO Auto-generated method stub

return mCommetnList.size();

}


@Override

public Object getItem(int position) {

// TODO Auto-generated method stub

return null;

}


@Override

public long getItemId(int position) {

// TODO Auto-generated method stub

return 0;

}

}

private void initChart() {

mChart = (HorizontalBarChart) findViewById(R.id.chart1);

mChart.setDrawBarShadow(false);

mChart.setDrawYValues(true);

mChart.setDrawValueAboveBar(false);


mChart.setDescription("");


mChart.setMaxVisibleValueCount(60);


mChart.set3DEnabled(false);


mChart.setPinchZoom(false);


mChart.setUnit(" ");


mChart.setDrawGridBackground(false);

mChart.setDrawHorizontalGrid(true);

mChart.setDrawVerticalGrid(false);


mChart.setValueTextSize(10f);


mChart.setDrawBorder(false);


//設置是否可以觸摸,如為false,則不能拖動,縮放等  

        mChart.setTouchEnabled(false); 


// Typeface tf = Typeface.createFromAsset(getAssets(),

// "OpenSans-Regular.ttf");


XLabels xl = mChart.getXLabels();

xl.setPosition(XLabelPosition.BOTTOM);

xl.setCenterXLabelText(true);

// xl.setSpaceBetweenLabels(30); // 設置數據之間的間距  

// xl.setTypeface(tf);


YLabels yl = mChart.getYLabels();

// yl.setTypeface(tf);

yl.setLabelCount(8);

yl.setPosition(YLabelPosition.BOTH_SIDED);

// yl.setLabelCount(5); // 設置Y軸最多顯示的數據個數  

// mChart.setValueTypeface(tf);


setData(5, 10);


Legend l = mChart.getLegend();

l.setPosition(LegendPosition.BELOW_CHART_LEFT);

l.setFormSize(8f);

l.setXEntrySpace(4f);

}


private void setData(int count, float range) {


ArrayList<String> xVals = new ArrayList<String>();

for (int i = 0; i < count; i++) {

xVals.add(mLevels[i]);

}


ArrayList<BarEntry> yVals1 = new ArrayList<BarEntry>();


for (int i = 0; i < count; i++) {

float mult = (range + 1);

float val = (float) (Math.random() * 40);

yVals1.add(new BarEntry(val, i));

}


BarDataSet set1 = new BarDataSet(yVals1, "水平分布圖");

set1.setBarSpacePercent(35f);

set1.setColor(Color.rgb(252, 131, 2));//設置曲線的顏色


ArrayList<BarDataSet> dataSets = new ArrayList<BarDataSet>();

dataSets.add(set1);


BarData data = new BarData(xVals, dataSets);


mChart.setData(data);

}


@Override

public void onClick(View v) {

switch (v.getId()) {

case R.id.back_btn:

finish();

break;


default:

break;

}

}


@Override

protected void onDestroy() {

super.onDestroy();

}

@Override

public boolean onCreateOptionsMenu(Menu menu) {

getMenuInflater().inflate(R.menu.comment, menu);

return false;

}

}


向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

浦北县| 阿荣旗| 青龙| 鄯善县| 湄潭县| 泾源县| 社旗县| 高阳县| 荥阳市| 洪洞县| 上高县| 宣汉县| 青河县| 井陉县| 宁德市| 平果县| 怀来县| 通化市| 盖州市| 邯郸市| 阿坝| 宾川县| 洱源县| 桃源县| 新蔡县| 绍兴县| 胶南市| 宁晋县| 湛江市| 共和县| 浙江省| 明光市| 贡觉县| 四平市| 武穴市| 肃南| 宜宾市| 依安县| 梁平县| 岚皋县| 且末县|