Tag: 中心

如何在默认主题(Theme.Holo.Light)中将ActionBar中心的标题alignment

我search了很多,但无法find一种方法,我怎么能设置标题在ActionBar中心,而不是左alignment。 我使用下面的代码来设置中心的标题: ViewGroup decorView= (ViewGroup) this.getWindow().getDecorView(); LinearLayout root= (LinearLayout) decorView.getChildAt(0); FrameLayout titleContainer= (FrameLayout) root.getChildAt(0); TextView title= (TextView) titleContainer.getChildAt(0); title.setGravity(Gravity.CENTER); 但它给错误如下: ClassCastException : com.android.internal.widget.ActionBarView can not be cast to android.widget.TextView. 任何其他解决scheme..任何帮助将不胜感激。

ActionBar标志居中,双方的行动项目

我怎么能做一个行动栏,在这个中心有两个标志? 我将使用ActionBar Sherlock。

Android:如何旋转中心点上的位图

我一直在寻找一个解决这个问题的一天,但没有什么帮助,甚至在这里的答案。 文档也没有解释任何东西。 我只是试图在另一个对象的方向旋转。 问题是位图不是围绕固定点旋转,而是绕着位图(0,0)旋转。 这是我遇到的代码: Matrix mtx = new Matrix(); mtx.reset(); mtx.preTranslate(-centerX, -centerY); mtx.setRotate((float)direction, -centerX, -centerY); mtx.postTranslate(pivotX, pivotY); Bitmap rotatedBMP = Bitmap.createBitmap(bitmap, 0, 0, spriteWidth, spriteHeight, mtx, true); this.bitmap = rotatedBMP; 奇怪的是,我怎么改变pre / postTranslate()的值和postTranslate()的float参数setRotation() 。 有人可以帮忙,把我推向正确的方向吗? 🙂

如何在Android上的TextView中横向和纵向放置文本?

如何在Android中的TextView中横向和纵向放置文本,使其看起来完全位于TextView的中间?

居中水平和垂直DIV

是否有一种垂直和水平居中的方式,但是,这一点很重要, 当窗口小于内容时,内容不会被剪切 。div必须有背景颜色和宽度以及高度。 我一直以div的绝对定位和负利润率为例。 但它存在的问题就是削减了内容。 有没有一种方法来中心div.content没有这个问题? 我有这个例子来玩: http : //jsbin.com/iquviq/1/edit CSS: body { margin: 0px; } .background { width: 100%; height: 100%; margin: 0; padding: 0; background-color: yellow; } /* is there a better way than the absolute positioning and negative margin to center the div .content: div with background color a width and a […]

如何中心绝对定位元素在div?

我需要在窗口的中心放置一个div (与position:absolute; )元素。 但是我遇到问题,因为宽度是未知的 。 我试过这个。 但是它需要调整,因为宽度是响应。 .center { left: 50%; bottom:5px; } 有任何想法吗?

如何将<div>与页面的中间(水平/宽度)alignment

我有一个宽度设置为800像素的div标签。 当浏览器宽度大于800像素,它不应该拉伸的div,但它应该把它带到页面的中间。