Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
石璀亮
/
system_info
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 2e64f86f
authored
Jul 19, 2017
by
石璀亮
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(parameter):add a recycleview for system parameter
1 parent
cf55b493
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
93 additions
and
7 deletions
app/src/main/java/com/nbbsw/cuiliang/systemsetting/CommonTableActivity.java
app/src/main/java/com/nbbsw/cuiliang/systemsetting/MainActivity.java
app/src/main/res/layout/activity_main.xml
app/src/main/java/com/nbbsw/cuiliang/systemsetting/CommonTableActivity.java
View file @
2e64f86
...
...
@@ -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
();
}
...
...
app/src/main/java/com/nbbsw/cuiliang/systemsetting/MainActivity.java
View file @
2e64f86
...
...
@@ -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
app/src/main/res/layout/activity_main.xml
View file @
2e64f86
<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
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment