Commit 2e64f86f by 石璀亮

feat(parameter):add a recycleview for system parameter

1 parent cf55b493
......@@ -198,6 +198,7 @@ public class CommonTableActivity extends Activity {
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {
if (buttonView.isChecked()) {
Toast.makeText(CommonTableActivity.this, "你点击的是第" + buttonView.getId() + "张",
Toast.LENGTH_LONG).show();
}
......
......@@ -4,21 +4,37 @@ import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.StaggeredGridLayoutManager;
import android.view.Gravity;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.List;
public class MainActivity extends AppCompatActivity {
public static TableLayout tableLayout;
private List<ItemUnit> fruitList = new ArrayList<ItemUnit>();
public static String one_Low[] = {"类型", "核数", "最高频率", "最低频率", "最大运行内存", "最小运行内存", "系统存储",
"内部存储", "宽度", "高度", "密度", "前摄像头像素", "后摄像头像素", "视频质量", "跑分", "支持所有传感器",
"支持root", "产品型号"};
public static String tow_Low[] = new String[one_Low.length];
public static String three_Low[] = new String[one_Low.length];
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
tableLayout = (TableLayout) findViewById(R.id.tableLayout);
tow_Low[0] = "MTK6737";
three_Low[0] = "MTK6737";
initFruits();
initBottom();
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.list_view);
......@@ -27,7 +43,36 @@ public class MainActivity extends AppCompatActivity {
ItemAdapter adapter = new ItemAdapter(MainActivity.this, fruitList);
recyclerView.setAdapter(adapter);
}
private void initBottom() {
for (int i = 0; i < one_Low.length; i++) {
TableRow row = new TableRow(this);
//创建显示的内容,这里创建的是一列
TextView text1 = new TextView(this);
TextView text2 = new TextView(this);
TextView text3 = new TextView(this);
//设置显示内容
text1.setText(one_Low[i]);
text1.setGravity(Gravity.CENTER);
text2.setText(tow_Low[i]);
text2.setGravity(Gravity.CENTER);
text3.setText(three_Low[i]);
text3.setGravity(Gravity.CENTER);
//添加到Row
row.addView(text1);
row.addView(text2);
row.addView(text3);
//将一行数据添加到表格中
tableLayout.addView(row);
}
}
@Override
protected void onPause() {
overridePendingTransition(0, 0);
super.onPause();
}
private void initFruits() {
......@@ -52,6 +97,4 @@ public class MainActivity extends AppCompatActivity {
fruitList.add(strawberry);
}
}
\ No newline at end of file
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:background="#626269"
>
<android.support.v7.widget.RecyclerView
android:id="@+id/list_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
android:layout_height="0dp"
android:layout_weight="1"
android:background="#ffffff"
/>
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:stretchColumns="*"
>
<TableRow>
<TextView
android:text="参数名称"
android:gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:text="当前值"
android:gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:text="出厂值"
android:gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</TableRow>
</TableLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<TableLayout
android:id="@+id/tableLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:stretchColumns="*" >
</TableLayout>
</ScrollView>
</LinearLayout>
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!