这是"预览"窗口的停靠模式选项.

我删除了停靠模式,即取消停靠.这就是我得到的.

没有更多"停靠模式"选项.现在我无法正确设计布局.当我更改布局中的任何内容时,预览会自动隐藏.
我试图使一个相对布局限制在一个圆圈内,即相对布局应该像下图所示的方形.
我试图将布局的宽度和高度设置为:
?((diameter)²/2) 大约70%
一圈内的正方形http://www.yogaflavoredlife.com/wp-content/uploads/2010/09/square-circle.gif
public class SquareLayout extends RelativeLayout {
public SquareLayout(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int originalWidth = MeasureSpec.getSize(widthMeasureSpec);
int originalHeight = MeasureSpec.getSize(heightMeasureSpec);
int required = Math.min(originalWidth, originalHeight) * 7 / 10;
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
setMeasuredDimension(required, required);
}
}
Run Code Online (Sandbox Code Playgroud)
我得到的是矩形布局而不是方形布局:

任何人都可以指导我哪里出错了吗?
样品用法:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.example.widget.SquareLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#F55C5C">
</com.example.widget.SquareLayout>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud) 我正在使用Vitamio库来播放rtsp直播.我尝试运行demo videoview类播放rtsp链接,如下所示:
http://117.103.224.75:1935/live/ definst /VTCHD3/VTCHD3_840x480_1200kbps.stream/playlist.m3u8
==>结果:它运行但质量非常差,加载视频非常低,视频中的图片不清晰,听不到声音.我不知道该怎么做才能让它运行平稳,画面清晰.请帮帮我这个问题!非常感谢 !
这是我的代码:
private String path="http://117.103.224.75:1935/live/_definst_/VTCHD3/VTCHD3_840x480_1200kbps.stream/playlist.m3u8";
private ProgressDialog prodlg;
private VideoView mVideoView;
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
if (!LibsChecker.checkVitamioLibs(this))
return;
setContentView(R.layout.videoview);
prodlg=new ProgressDialog(this);
prodlg.setIcon(R.drawable.ic_launcher);
prodlg.setMessage("wating...");
prodlg.show();
mVideoView = (VideoView) findViewById(R.id.surface_view);
if (path == "") {
// Tell the user to provide a media file URL/path.
Toast.makeText(VideoViewDemo.this, "Please edit VideoViewDemo Activity, and set path" + " variable to your media file URL/path", Toast.LENGTH_LONG).show();
return;
} else {
/*
* Alternatively,for streaming media you can …Run Code Online (Sandbox Code Playgroud) 我正在尝试实现如下布局:

两个视图,线性布局中的重量2(绿色视图)和1(蓝色视图).并且浮动按钮位于它们前面的那些视图之间.但是使用线性布局是不可能的.任何人都可以在这里给予一些帮助
更新:这就是我所做的
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2"
android:background="#22B14C" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="To be a floating button" />
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#00A2E8" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
而我得到的是

我有这个挑战:在我的肖像模式中,我使用了一个cardview来包含一个数组中的图像和文本,他们采用了两列,这对我很好.但是,同样的安排发生在景观安卓手机中,这会在图像之间和之后创建空间.如何在横向三(3)中制作列?这是纵向布局的代码:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_columnSpan="2"
android:layout_column="2">
<android.support.v7.widget.CardView
android:layout_width="165dp"
android:layout_height="wrap_content"
android:layout_marginBottom="0dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="9dp"
android:clickable="true"
android:foreground="?android:attr/selectableItemBackground"
card_view:cardBackgroundColor="@color/bright_foreground_material_dark"
card_view:cardCornerRadius="3dp"
card_view:cardElevation="0.01dp">
<RelativeLayout
android:id="@+id/top_layout"
android:layout_width="165dp"
android:layout_height="160dp">
<ImageView
android:id="@+id/img_thumbnail"
android:layout_width="wrap_content"
android:layout_height="150dp"
android:layout_above="@+id/tv_species"
android:scaleType="fitXY" />
<TextView
android:id="@+id/tv_species"
android:layout_width="fill_parent"
android:layout_height="40dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_gravity="bottom"
android:background="@color/custom_two"
android:gravity="center_vertical"
android:paddingLeft="5dp"
android:paddingRight="2dp"
android:text="Test"
android:textColor="#fff"
android:textSize="20dp" />
</RelativeLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)