2013-02-17 56 views
2

我经历了一些尴尬的行为。下面的LinearLayout被分配了正确的背景,但是所有的角落半径都被简单地解散了。问题是为什么,以及我如何解决这个问题?如果我在TextView上设置android:background,它工作正常。不要加权LinearLayouts支持round-rect背景吗?

为什么我将TextView放在LinearLayout中呢?我想动画TextView的文本。只有文字,而不是背景。所以我将它包装到LinearLayout中。

<LinearLayout 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:background="@drawable/summary_title_horizontal_last" > 

      <TextView 
       android:id="@+id/evaluation_highscore_title" 
       style="@style/Summary.Title" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="@string/evaluation_highscore" 
       android:textAppearance="?android:attr/textAppearanceMedium" 
       android:textStyle="bold" /> 
     </LinearLayout> 

@绘制/ summary_title_horizo​​ntal_last:

<?xml version="1.0" encoding="utf-8"?> 
<shape xmlns:android="http://schemas.android.com/apk/res/android"> 
    <gradient 
     android:startColor="@color/summary_title_start" 
     android:endColor="@color/summary_title_end" 
     android:angle="270" /> 

    <corners android:bottomLeftRadius="@dimen/summary_box_radius" /> 

</shape> 

回答

0

你确定你的TextView不图中的实角落的背景是什么?你似乎没有填充你的LinearLayout让孩子远离角落,所以他们不重画背景(尽管我不知道你的Summary.Title风格是什么 - 你可能会在那里使用空白)。

在这种情况下,Hierarchy Viewer是无价之宝,因为您可以根据不同的背景查看每个视图正在绘制的内容。

+0

太愚蠢了。是的,电视的风格设置相同的背景,但*没有*任何圆角。简单的透支。 – poitroae 2013-02-18 15:22:30