我在android中有一个没有的应用程序.的活动.现在我需要非活动类中当前正在运行的活动的上下文.我怎么能得到它.
Android视频在纵向时不适合视频的宽度,如何在纵向时使我的视频宽度适合我的视频宽度,当我将屏幕的方向更改为横向时我想要视频填充整个屏幕就像youtube应用程序一样.当在纵向时,视频将从屏幕的顶部到中间开始,并且在横向时用于填充整个屏幕.这是我尝试过的,我还添加了完整截图的链接
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:weightSum="100" >
<VideoView
android:id="@+id/videoview"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_gravity="center"
android:layout_weight="53" >
</VideoView>
<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="7"
android:background="@drawable/top_bar"
android:orientation="horizontal" >
<LinearLayout
android:id="@+id/settings"
android:layout_width="50dp"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical"
android:paddingBottom="5dp"
android:paddingTop="5dp" >
<ImageView
android:id="@+id/set"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/desc"
android:src="@drawable/settings" />
</LinearLayout>
<LinearLayout
android:id="@+id/low_tab"
android:layout_width="70dp"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical"
android:paddingBottom="5dp"
android:paddingTop="5dp" >
<ImageView
android:id="@+id/low"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/desc"
android:src="@drawable/low" />
</LinearLayout>
<LinearLayout
android:id="@+id/high_tab"
android:layout_width="80dp"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical"
android:paddingBottom="5dp"
android:paddingTop="5dp" >
<ImageView
android:id="@+id/high"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/desc"
android:src="@drawable/high" />
</LinearLayout>
<LinearLayout
android:id="@+id/audio_tab"
android:layout_width="70dp" …Run Code Online (Sandbox Code Playgroud) android portrait fullscreen android-layout android-videoview
我正在为MAC OS开发一个SWT java项目,我需要在SWT UI上添加一个标签,我必须显示当前时间,每秒更新一次.我试过了,即
final Label lblNewLabel_1 = new Label(composite, SWT.CENTER);
FormData fd_lblNewLabel_1 = new FormData();
fd_lblNewLabel_1.left = new FormAttachment(btnNewButton_call, 10);
fd_lblNewLabel_1.bottom = new FormAttachment(100, -10);
fd_lblNewLabel_1.right = new FormAttachment(btnTransfer, -10);
fd_lblNewLabel_1.height = 20;
lblNewLabel_1.setLayoutData(fd_lblNewLabel_1);
getDisplay().syncExec(new Runnable() {
@Override
public void run() {
while(true){
lblNewLabel_1.setText(Calendar.getInstance().getTime().toString());
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
});
Run Code Online (Sandbox Code Playgroud)
但它不起作用,请帮助我这样做.提前致谢.