Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
YGOMobile-Cn-Ko-En
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fallenstardust
YGOMobile-Cn-Ko-En
Commits
d6b681d4
Commit
d6b681d4
authored
Sep 21, 2021
by
kenan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加自定义view测试
parent
14fdeb99
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
1 deletion
+17
-1
libcore/src/main/java/cn/garymb/ygomobile/YGOMobileActivity.java
.../src/main/java/cn/garymb/ygomobile/YGOMobileActivity.java
+16
-0
mobile/src/main/java/cn/garymb/ygomobile/utils/DensityUtils.java
...src/main/java/cn/garymb/ygomobile/utils/DensityUtils.java
+1
-1
No files found.
libcore/src/main/java/cn/garymb/ygomobile/YGOMobileActivity.java
View file @
d6b681d4
...
@@ -17,6 +17,8 @@ import android.view.Gravity;
...
@@ -17,6 +17,8 @@ import android.view.Gravity;
import
android.view.HapticFeedbackConstants
;
import
android.view.HapticFeedbackConstants
;
import
android.view.KeyEvent
;
import
android.view.KeyEvent
;
import
android.view.View
;
import
android.view.View
;
import
android.widget.FrameLayout
;
import
android.widget.ImageView
;
import
android.widget.PopupWindow
;
import
android.widget.PopupWindow
;
import
android.widget.TextView
;
import
android.widget.TextView
;
import
android.widget.Toast
;
import
android.widget.Toast
;
...
@@ -217,6 +219,20 @@ public class YGOMobileActivity extends GameActivity implements
...
@@ -217,6 +219,20 @@ public class YGOMobileActivity extends GameActivity implements
public
void
setContentView
(
View
view
)
{
public
void
setContentView
(
View
view
)
{
super
.
setContentView
(
view
);
super
.
setContentView
(
view
);
app
().
attachGame
(
this
);
app
().
attachGame
(
this
);
//可以通过mLayout.addView添加view,增加功能
//test code
// int size = (int) (getResources().getDisplayMetrics().density * 100);
// FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(size, size);
// lp.gravity = Gravity.RIGHT|Gravity.BOTTOM;
// ImageView imageView = new ImageView(this);
// imageView.setImageResource(android.R.drawable.sym_def_app_icon);
// imageView.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// refreshTextures();
// }
// });
// mLayout.addView(imageView, lp);
}
}
private
void
initExtraView
()
{
private
void
initExtraView
()
{
...
...
mobile/src/main/java/cn/garymb/ygomobile/utils/DensityUtils.java
View file @
d6b681d4
...
@@ -11,7 +11,7 @@ public class DensityUtils {
...
@@ -11,7 +11,7 @@ public class DensityUtils {
return
0
;
return
0
;
}
}
float
density
=
ctx
.
getResources
().
getDisplayMetrics
().
density
;
float
density
=
ctx
.
getResources
().
getDisplayMetrics
().
density
;
int
px
=
(
int
)
(
dp
*
density
+
0.5f
);
// 4.9->5 4.4->4
int
px
=
Math
.
round
(
dp
*
density
);
// 4.9->5 4.4->4
return
px
;
return
px
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment