标签: alignment

TextView中的问题在android中对齐

我想问一下如何更改布局以获取将ID rowType设置为绝对正确位置的TextView.目前我已将引力设置为右,但当前设置在上面的TextView右侧(id:row)对齐.因此,如果TextView行在屏幕的一半结束,TextView rowType结束于一半...

<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:background="@color/notepad_paper">
  <TableRow 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      android:fadingEdge="vertical" 
      android:fadeScrollbars="true" 
      android:gravity="left" 
      android:layout_gravity="left|center_horizontal">
      <ImageView 
        android:id="@+id/rowImgFav" 
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:padding="5dp"
        android:paddingLeft="20dp"
        android:paddingRight="40dp"
        android:scrollbars="vertical"
        android:fadingEdge="vertical"
        android:layout_alignParentRight="true"
      /> 
    <ImageView 
        android:id="@+id/rowImg" 
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:padding="5dp"
        android:scrollbars="vertical"
        android:fadingEdge="vertical"
        android:layout_alignParentRight="true"
      />

        <TableLayout 
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">
            <TableRow 
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                >
                <TextView
                android:id="@+id/row"
                android:layout_height="fill_parent"
                android:layout_width="fill_parent" 
                android:paddingLeft="10dp"
                android:paddingBottom="0dp"
                android:textSize="14dp"
                android:textStyle="bold"
                android:textColor="@color/notepad_text" /> 
            </TableRow>
            <TableRow>
                <TextView
                android:id="@+id/rowType"
                android:layout_height="fill_parent"
                android:layout_width="fill_parent"  
                android:padding="0dp"
                android:paddingTop="2dp"
                android:textSize="10dp"
                android:textStyle="normal"
                android:gravity="right"
                android:textColor="@color/notepad_text" />
            </TableRow>
        </TableLayout> 
  </TableRow>
</TableLayout>  
Run Code Online (Sandbox Code Playgroud)

android alignment

1
推荐指数
1
解决办法
1万
查看次数

java swing aligning radiobuttons

我想我中心在radibuttons面板,但是当我居中根据按钮的文字lenght中心,所以是他们中心而不是相互对齐,并期待非常难看.我该如何修复我的代码?

radioButtonMenuPanel = new JPanel();
    radioButtonMenuPanel.setLayout(new BoxLayout(radioButtonMenuPanel,
            BoxLayout.PAGE_AXIS));

    ButtonGroup group = new ButtonGroup();
    for (String item : answerItems) {
        JRadioButton radioButton = new JRadioButton(item);
        radioButton.setAlignmentX(Component.Center_ALIGNMENT);
        radioButtonMenuPanel.add(radioButton);
        group.add(radioButton);
    }
Run Code Online (Sandbox Code Playgroud)

java swing alignment jpanel radio-button

1
推荐指数
1
解决办法
8697
查看次数

在JOptionPane中将文本对齐到右侧

是否可以在JOptionPane中将文本对齐?(我不想使用JDialog)因为我想用阿拉伯语写一些句子

java alignment arabic joptionpane

1
推荐指数
2
解决办法
1万
查看次数

对齐<h:panelGrid />中的元素

我想对齐元素,如下图所示. 在此输入图像描述

有2列.一个与父母左边对齐,另一个与右边对齐.我不想在px或em中指定任何内容.我如何实现这一目标<h:panelGrid />

jsf alignment

1
推荐指数
1
解决办法
8575
查看次数

CSS:中心对齐

我有以下CSS菜单,float:left;我怎么能成为这个中心.我在哪里添加margin:0 auto

CSS:

/* === 7. Navigation === */

#nav{
    width:100%;
    margin:30px auto;
}

.ie7 #nav{
    padding:10px 0 0 30px;
}

#nav ul li{
    margin:0 auto;
}

#nav li{
    float:left;
    text-align:center;
    list-style:none;
    font-weight:bold;
}
#nav li a{
    margin-right:30px;
    text-decoration:none;
    color:#5d5e5d;
}

#nav li a:hover{
    text-decoration:underline;

}

#nav li a:active{
    font-family:inherit;
    font-size:inherit;
    color:#fff;
}
Run Code Online (Sandbox Code Playgroud)

HTML:

  <ul id="nav"><!--Navigation-->
                    <li id="homenav"><a href="#home">Home</a></li>
                    <li id="portfolionav"><a href="#portfolio">Portfolio</a></li>
                    <li id="contactnav"><a href="#contact">Contact</a></li>
   </ul>
Run Code Online (Sandbox Code Playgroud)

css menu alignment

1
推荐指数
1
解决办法
1万
查看次数

IE 7在桌面上增加了额外的高度

我试图找到为什么IE增加了额外的空间.这是一个临时图像,唯一的静态数据是图像宽度(171像素).

在Jquery中我提醒了div高度,在Firefox,Chrome和Opera中,div高度为164px,但在IE 7上它有172个!

火狐:

火狐

铬:

铬

IE 7:

IE 7

HTML:

<div class='wide-box'>
            <table border="0" cellspacing="0" cellpadding="0" width="171">
                <tr><td height="7"><img src="images/wide-box-header.png" width="100%" alt='' /></td></tr>
                <tr><td class='y-repeat'><img src="images/temp/3.png" alt=''/></td></tr>
                <tr><td height="9"><img src="images/wide-box-footer.png" width="100%" alt='' /></td></tr>
                <tr><td class='shadow'></td></tr>
            </table>
        </div><!-- WIDE BOX -->
Run Code Online (Sandbox Code Playgroud)

CSS:

.wide-box{
    display:block;
    width:171px;
    float:right;
    margin-right:10px;
}

.wide-box .y-repeat img { display:block;margin:0 auto; }
.wide-box .y-repeat { background:url(images/wide-box-y-repeat.png) top left repeat-y; }
.wide-box .shadow { height:10px;background:url(images/wide-box-shadow.png) top center no-repeat; }
Run Code Online (Sandbox Code Playgroud)

jQuery的:

$(window).load(function(){
    $(".wide-box table").height( $(".wide-box .y-repeat img").height() + 24 );
});
Run Code Online (Sandbox Code Playgroud)

为什么IE讨厌我?

html css internet-explorer alignment

1
推荐指数
1
解决办法
399
查看次数

将<a>与底部对齐,同时将它们居中?

我使用text-align元素使我的导航菜单居中.我还使用position和bottom元素将它对齐到父div的底部,但是当我使用position和bottom元素时,它会取消文本对齐.为什么这样做?http://jsfiddle.net/CQTEY/

HTML

<div class="header">
    <div class="logo">
    <img src="/images/logo.png" width="96" height="82">
    </div>    
    <div id="nav">
    <a href="#">Portfolio</a>
    <a href="#">About</a>
    <a href="#">Contact</a>
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

CSS

.header {
    position:relative;
    background-color: #2C2E31;
    border-bottom: #242426 2px solid;
    height: 182px;
    position:relative;
}
#nav {
    position:absolute;
    bottom:0;
    text-align:center; 
    text-decoration:none; 
    font-size:20px;
    font-family:raleway-regular; 
}
#nav a {
    border-bottom:#FFFFFF 2px solid; 
    color:#FFFFFF;
    text-decoration:none; 
    margin-left: 8px; 
    margin-right:8px;
}
Run Code Online (Sandbox Code Playgroud)

html css position alignment

1
推荐指数
1
解决办法
60
查看次数

使用CSS进行文本的垂直和水平对齐

我试图在div框(背景颜色)内水平和垂直对齐文本,但我无法做到.

我在网上搜索过margin: auto,text-align: center并没有做好工作.

有小费吗?

检查FIDDLE.

HTML

<div id="services"><div class="holder container clearfix">
<div class="bgtop"><span class="top">Corte cabelo + Afiar</span></div>
<div class="bgprice"><span class="price">10€</span></div>
</div></div>
Run Code Online (Sandbox Code Playgroud)

CSS

#services .holder .bgtop{
    background-color: #27ae60;
    height:50px;
    width:200px;
    z-index: 1;
}
#services .holder .bgprice{
    height:50px;
    width:90px;
    background-color: #272727;
    z-index: 1;
}
#services .holder span.top{
    color: white;
    font-style: italic;
    font-weight: bold;
    font-size: 1.000em;
    z-index: 2;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;  
    margin: auto;
    text-align: center;
}
#services .holder span.price{
    color: white; …
Run Code Online (Sandbox Code Playgroud)

html css center alignment

1
推荐指数
1
解决办法
2826
查看次数

将复选框与td样式中心对齐复选框?

我有一个包含复选框的特定行的表.我希望这些复选框与父td的中心对齐.我知道我可以通过样式化父td来实现这一目标:

td {
    text-align: center;
}
Run Code Online (Sandbox Code Playgroud)

我也知道我可以用jQuery轻松实现这一点,但不幸的是,我不能使用jQuery.

该表是通过.NET创建的,我不能通过给出某个类来定位包含复选框的特定列.

我想知道是否有一种方式来设置复选框本身,以便将其与其父级td的中心对齐.

就像是:

input[type=checkbox] {
    margin: auto;
}
Run Code Online (Sandbox Code Playgroud)

css checkbox alignment css-tables

1
推荐指数
1
解决办法
7294
查看次数

容器的样式以在内部垂直对齐图像

我希望容器内部的图像垂直居中对齐。我在下面尝试过,都失败了:

display:"inline-block", alignItems:"center", valign:"middle", verticalAlign:"middle", 
Run Code Online (Sandbox Code Playgroud)

我的代码如下:

<p style={{display:"inline-block", alignItems:"center", valign:"middle",
verticalAlign:"middle", textAlign:"center", width: "100%", height: "100%" }}>

<img style={{height: "auto", display:"inline-block", valign:"middle",
verticalAlign:"middle", width: "auto", maxWidth: "380px", maxHeight: "200px", 
overflow: "hidden" }}
src= "http://icons.iconarchive.com/icons/paomedia/small-n-flat/256/sign-check-icon.png" />

</p>
Run Code Online (Sandbox Code Playgroud)

styles alignment vertical-alignment reactjs

1
推荐指数
1
解决办法
7921
查看次数