我有一个数据框,在不同的日期从临床分离株中发现了许多感染.
到目前为止,我已将数据组织成我想要开始使用的形状.我正在尝试为报告的描述性统计准备一系列表格表.
我一直在使用ftable并获得以下内容:
onset.types <- ftable(SAB$Onset,SAB$MRSA.Type,year(SAB$Collection.Date))
2005 2006 2007 2008 2009 2010
Community 454 472 512 499 525 512
AUS-2/3-like 28 23 27 29 32 38
EMRSA-15-like 9 4 4 9 8 8
nmMRSA 40 47 53 39 64 60
Other mMRSA 1 3 3 11 5 9
unclassified MRSA 0 2 0 0 1 1
Hospital 163 163 156 164 149 165
AUS-2/3-like 31 33 27 31 29 28
EMRSA-15-like 3 8 5 9 4 3
nmMRSA …Run Code Online (Sandbox Code Playgroud) 我想打开所有不同设备的屏幕一半的抽屉列表.我尝试将layout_margineleft 200dp或100dp的硬编码值写入抽屉列表.但它不适用于所有不同设备的设备.那么如何才能为抽屉列表保留一半的屏幕.我也尝试了各种功能,如setLeft(int)等.但由于我使用的是最低版本8,因此其中一些功能不起作用.所以请帮助我.提前致谢.
mDrawerLayout = (DrawerLayout) view.findViewById(R.id.drawer_layout);
mDrawerList = (ListView) view.findViewById(R.id.top_sectionlist);
Run Code Online (Sandbox Code Playgroud)
xml为:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/setting_background" >
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:layout_margin="@dimen/top_news_linear_margin"
android:background="@color/news_list_divider_color"
android:orientation="vertical"
android:padding="@dimen/top_news_linear_padding" >
</RelativeLayout>
<ListView
android:id="@+id/drawer_list"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_gravity="right"
android:layout_alignParentTop="true"
android:background="@color/setting_background"
android:cacheColorHint="@android:color/transparent"
android:choiceMode="singleChoice"
android:divider="@color/news_list_divider_color"
android:dividerHeight="@dimen/news_list_divider_height"
/>
</android.support.v4.widget.DrawerLayout>
Run Code Online (Sandbox Code Playgroud) 我想知道如何使用屏幕高度和宽度以编程方式设置layout_marginLeft,layout_marginTop,layout_marginBottom.请帮我.
谢谢Monali
我在哪里做错了?
这是正常的打印预览:

但我想看到这张照片(没有拖动边距箭头)

这是css代码和预览:

我RecyclerView在我的应用程序中使用并且为了我的设计需要,我需要在列表中的项目之间有不同的边距(例如:前两个项目之间的空间为16dp,第二个和第三个之间的空间项目32dp等).我读到你可以添加项目装饰RecyclerView并在项目之间创建该空间.但是这个东西在所有项目之间增加了相同的余量,我希望不同的项目有不同的行为.我的问题是,可以使用项目装饰来完成吗?这种方法如何比改变项目(视图)的边距更好,例如,onBindViewHolder方法中的方法RecyclerView.Adapter.先感谢您!
我有2行CSS用于在除最后一个元素之外的每个元素上设置边距.有没有办法将它组合成一行?
这就是我目前(工作):
.work img {
margin-right: 10px;
}
.work img:last {
margin-right: 0px;
}
Run Code Online (Sandbox Code Playgroud)
我尝试将其更改为:
.work img:not(:last) {
margin-right: 10px;
}
Run Code Online (Sandbox Code Playgroud)
但它不起作用?知道为什么吗?
更新我只有五张图片.我的另一个选择是只有前四个的利润.
我有一个简单的看法:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/contact_selected"
android:layout_marginTop="10dp"
android:layout_marginEnd="5dp"
android:orientation="horizontal"
android:padding="3dp">
<TextView
android:id="@+id/txt_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Billy Bob"
/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
当我将LinearLayout标记静态复制到我的主活动布局时,边距是预期的.但是,当我动态地将视图添加到主活动布局中时,将忽略边距.这是我插入视图的方式
LayoutInflater inflater = (LayoutInflater)
getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.test, null);
TextView txt_title = (TextView)view.findViewById(R.id.txt_title);
txt_title.setText("Dynamic #1");
llayout.addView(view, llayout.getChildCount()-1);
View view2 = inflater.inflate(R.layout.test, null);
txt_title = (TextView)view2.findViewById(R.id.txt_title);
txt_title.setText("Dynamic #2");
llayout.addView(view2, llayout.getChildCount()-1);
Run Code Online (Sandbox Code Playgroud)
这是它的样子:
主布局中的容器是LinearLayout,它是HorizontalScrollView的子级.任何见解都表示赞赏.
我在应用程序工具栏中的图标和导航图标(如图像中)之间得到了这个奇怪的边距.我不知道它来自何处以及如何将其删除.在搜索互联网后,我发现了这个:
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/toolbar"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:fitsSystemWindows="true"
android:minHeight="?attr/actionBarSize"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
android:background="?attr/colorPrimaryDark"
android:layout_margin="0dp"
android:contentInsetLeft="0dp"
android:contentInsetRight="0dp"
android:contentInsetStart="0dp"
android:contentInsetEnd="0dp"
android:padding="0dp"
app:contentInsetLeft="0dp"
app:contentInsetRight="0dp"
app:contentInsetStart="0dp"
app:contentInsetEnd="0dp">
</android.support.v7.widget.Toolbar>
Run Code Online (Sandbox Code Playgroud)
编辑>>解决方案
好吧,在使用布局绑定后,我认为很多边缘都是图标(如图所示).但是我仍然可以删除此边距并更改图标和标题文本的大小.

编辑
关注@Amir解决方案:java的助手:
class BasicActivity extends AppCompatActivity{
protected Toolbar mToolbar; /// Initilize it in onCreate methode
.....
protected void setupToolbar(String title) {
toolbar=(Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
ActionBar ab = getSupportActionBar();
if (ab != null) {
ab.setDisplayHomeAsUpEnabled(true);
ab.setDisplayShowHomeEnabled(true);
}
if (!TextUtils.isEmpty(title)) {
setTitle(title);
}
}
}
Run Code Online (Sandbox Code Playgroud)
在你的活动课上:
class Main extends BasicActivity{
@override
protected void onCreate(Bundle saved){
super.onCreate(saved);
.... …Run Code Online (Sandbox Code Playgroud) 请问任何人都可以告诉我如何摆脱VS2015编辑器左边缘的边距?
我不介意"指标边距",但现在我和代码的开头之间有一个很大的空间.在工具选项 - 文本编辑器 - 常规 - 显示中,我关闭了"选择边距".打开它会使差距更大.
我相信额外的保证金是由新的"代码辅助"灯泡使用的,我很乐意关闭它,但我找不到它的选择.
我安装了Productivity Power Tools扩展,但我不认为这是负责任的.
我发现这里有一个答案:如何在Visual Studio 2015中禁用灯泡? 但这涉及修改项目文件,这将影响整个团队,他们不希望我将其关闭.我感兴趣的是,关闭是否关闭所有代码分析会修复扩大的边距,所以我尝试禁用所有规则.可悲的是,这对左手边缘没有任何影响!
我正在使用带有StaggeredGridLayoutManager的RecyclerView来创建一个两列列表.但是如何在左列和右列之间设置右边距.我已经使用此代码从顶部创建右边距,但如何解决列之间的双倍空格.
public class SpacesItemDecoration extends RecyclerView.ItemDecoration {
private int space;
public SpacesItemDecoration(int space) {
this.space = space;
}
@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
outRect.left = space;
outRect.right = space;
outRect.bottom = space;
// Add top margin only for the first or second item to avoid double space between items
// Add top margin only for the first or second item to avoid double space between items
if((parent.getChildCount() > 0 && parent.getChildPosition(view) == 0) …Run Code Online (Sandbox Code Playgroud)