0

私はアプリケーションを持っており、私のレイアウト(以下のxmlを参照)にはVideoView、 (ここTextViewで私の質問と同じアプリケーションですが、レイアウトにいくつかの変更があります)があります。開始します。私は何を間違っていますか?TextView

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical">
<VideoView
    android:id="@+id/videoview"
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_above="@+id/textview"
/>
<TextView 
    android:id="@+id/textview" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content"
    android:layout_gravity="bottom"
    android:layout_alignParentBottom="true"
    android:maxLines="30" 
    android:text="My test App"
/>
</RelativeLayout>

編集:Javaコードの一部を追加

それを使用する私のコードは非常に単純です:

setContentView(R.layout.auto);

_mTextView = (TextView)findViewById(R.id.textview);
_mTextView.setLines(30);
_mTextView.setMovementMethod(new ScrollingMovementMethod());

_mVideoView = (VideoView)findViewById(R.id.videoview);

ビデオを開始するには、TCP サーバーとリフレクションを使用します。TextView

4

2 に答える 2

0

ここで得たソリューションに戻って(Sunilに感謝)、それを少し変更することで、問題の解決策を見つけることができました(私の質問にも記載されています):

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical">
<VideoView
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:id="@+id/videoview"
    android:layout_above="@+id/ScrollView01"
/>
<ScrollView   
    android:id="@+id/ScrollView01"  
    android:layout_height="350px"   
    android:layout_width="fill_parent"
    android:layout_gravity="bottom"
    android:layout_alignParentBottom="true"
    >
<TextView 
    android:layout_width="wrap_content" 
    android:id="@+id/textview" 
    android:layout_height="wrap_content" 
    android:text="Wellcome"
/>
</ScrollView>
</RelativeLayout>

変更は ScrollViewにあります。android:layout_height="350px"代わりにandroid:layout_height="wrap content" 、画面の下部に配置されますが、特定のサイズであり、それ以上ではありません。可能な限りクリーンな方法ではありませんが、私が必要としているものを正確に満たしています。誰かがそれを役に立つと思うことを願っています。

于 2011-03-29T19:53:41.403 に答える
0

メディアプレーヤーを使用しているのに、サーフェスビューを使用しないのはなぜですか?

private void iniElements() {
    mPreview = (SurfaceView) findViewById(R.id.screen_tutorial_video_surface);
    holder = mPreview.getHolder();
    holder.addCallback(this);
    holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
    holder.setFixedSize(getWindow().getWindowManager().getDefaultDisplay().getWidth(), getWindow().getWindowManager().getDefaultDisplay().getHeight());
    mMediaPlayer = new MediaPlayer();
    mMediaPlayer.setDisplay(holder);
}

private void iniPlayer() {
    try {
        mMediaPlayer.setDataSource(videoPath); 
        mMediaPlayer.prepare();
    } catch (IllegalArgumentException e) {
        e.printStackTrace();
    } catch (IllegalStateException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }
    mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
}
于 2011-03-19T21:29:22.573 に答える