teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

3

追記

2018/04/09 09:12

投稿

glat2238
glat2238

スコア124

answer CHANGED
@@ -1,55 +1,1 @@
1
- 最初に字幕を表示する時間を全部取得しちゃってタイマー機能で字幕の動きを動画と最初に同期させちゃって後は字幕と動画を同時に再生すれば綺麗に流れると思う
1
+ 最初に字幕を表示する時間を全部取得しちゃってタイマー機能で字幕の動きを動画と最初に同期させちゃって後は字幕と動画を同時に再生すれば綺麗に流れると思う
2
-
3
- 追記:
4
-
5
-
6
- こんな感じかな(androidたまにしかやらないので間違ってたらすいません。)
7
- 指定された間隔でテキストをカウントアップするという謎のコード
8
- ```
9
- //スレッドUI操作用ハンドラ
10
- private Handler mHandler = new Handler();
11
- //テキストオブジェクト
12
- private Runnable updateText;
13
- //間隔
14
- private int[] wait = //ここにまつ間隔を
15
-
16
- @Override
17
- protected void onCreate(Bundle savedInstanceState) {
18
- super.onCreate(savedInstanceState);
19
- setContentView(R.layout.activity_main);
20
- updateText = new Runnable() {
21
- public void run() {
22
- TextView text = (TextView) findViewById(R.id.count);
23
- Integer count = Integer.valueOf(text.getText().toString());
24
- count += 1;
25
- text.setText(count.toString());
26
- mHandler.removeCallbacks(updateText);
27
- mHandler.postDelayed(updateText, wait[count]);
28
- }
29
- };
30
- mHandler.postDelayed(updateText, wait[0]);
31
- }
32
-
33
- ```
34
- ```
35
- <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
36
- xmlns:tools="http://schemas.android.com/tools"
37
- android:layout_width="match_parent"
38
- android:layout_height="match_parent"
39
- android:paddingBottom="@dimen/activity_vertical_margin"
40
- android:paddingLeft="@dimen/activity_horizontal_margin"
41
- android:paddingRight="@dimen/activity_horizontal_margin"
42
- android:paddingTop="@dimen/activity_vertical_margin"
43
- tools:context=".MainActivity" >
44
-
45
- <TextView
46
- android:id="@+id/count"
47
- android:layout_width="wrap_content"
48
- android:layout_height="wrap_content"
49
- android:text="0" />
50
-
51
- </RelativeLayout>
52
-
53
- ```
54
-
55
- 参考:https://dev.classmethod.jp/smartphone/android/android-tas/

2

追記

2018/04/09 09:12

投稿

glat2238
glat2238

スコア124

answer CHANGED
@@ -1,1 +1,55 @@
1
- 最初に字幕を表示する時間を全部取得しちゃってタイマー機能で字幕の動きを動画と最初に同期させちゃって後は字幕と動画を同時に再生すれば綺麗に流れると思う
1
+ 最初に字幕を表示する時間を全部取得しちゃってタイマー機能で字幕の動きを動画と最初に同期させちゃって後は字幕と動画を同時に再生すれば綺麗に流れると思う
2
+
3
+ 追記:
4
+
5
+
6
+ こんな感じかな(androidたまにしかやらないので間違ってたらすいません。)
7
+ 指定された間隔でテキストをカウントアップするという謎のコード
8
+ ```
9
+ //スレッドUI操作用ハンドラ
10
+ private Handler mHandler = new Handler();
11
+ //テキストオブジェクト
12
+ private Runnable updateText;
13
+ //間隔
14
+ private int[] wait = //ここにまつ間隔を
15
+
16
+ @Override
17
+ protected void onCreate(Bundle savedInstanceState) {
18
+ super.onCreate(savedInstanceState);
19
+ setContentView(R.layout.activity_main);
20
+ updateText = new Runnable() {
21
+ public void run() {
22
+ TextView text = (TextView) findViewById(R.id.count);
23
+ Integer count = Integer.valueOf(text.getText().toString());
24
+ count += 1;
25
+ text.setText(count.toString());
26
+ mHandler.removeCallbacks(updateText);
27
+ mHandler.postDelayed(updateText, wait[count]);
28
+ }
29
+ };
30
+ mHandler.postDelayed(updateText, wait[0]);
31
+ }
32
+
33
+ ```
34
+ ```
35
+ <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
36
+ xmlns:tools="http://schemas.android.com/tools"
37
+ android:layout_width="match_parent"
38
+ android:layout_height="match_parent"
39
+ android:paddingBottom="@dimen/activity_vertical_margin"
40
+ android:paddingLeft="@dimen/activity_horizontal_margin"
41
+ android:paddingRight="@dimen/activity_horizontal_margin"
42
+ android:paddingTop="@dimen/activity_vertical_margin"
43
+ tools:context=".MainActivity" >
44
+
45
+ <TextView
46
+ android:id="@+id/count"
47
+ android:layout_width="wrap_content"
48
+ android:layout_height="wrap_content"
49
+ android:text="0" />
50
+
51
+ </RelativeLayout>
52
+
53
+ ```
54
+
55
+ 参考:https://dev.classmethod.jp/smartphone/android/android-tas/

1

読みやすさの評価向上

2018/04/09 09:10

投稿

glat2238
glat2238

スコア124

answer CHANGED
@@ -1,1 +1,1 @@
1
- 最初に字幕を表示する時間を全部取得しちゃってタイマー機能とかを使って字幕を動画と連携しながら再生するんじゃなくて字幕の動きを動画と最初に同期させちゃって後は字幕と動画を同時に再生すれば綺麗に流れると思う
1
+ 最初に字幕を表示する時間を全部取得しちゃってタイマー機能字幕の動きを動画と最初に同期させちゃって後は字幕と動画を同時に再生すれば綺麗に流れると思う