2013-12-16 38 views
2

enter image description here的FrameLayout前景改變佈局

當我的FrameLayout添加前景每個孩子就像是填充在左側和頂部

有人知道如何解決這一問題?

layout.xml

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    xmlns:mwbutton="http://schemas.android.com/apk/res-auto" 
    android:id="@+id/FrameLayout1" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:foreground="@drawable/view_selector" 
    tools:context=".MainActivity" > 

    <TextView 
     android:id="@+id/textView1" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:gravity="center" 
     android:background="#ff0000" 
     android:text="TextView" /> 

</FrameLayout> 

選擇

<?xml version="1.0" encoding="utf-8"?> 
<selector xmlns:android="http://schemas.android.com/apk/res/android"> 

    <item android:drawable="@drawable/pretao" android:state_pressed="true"/> 
    <item android:drawable="@android:color/transparent"/> 

</selector> 

回答

1

@drawable/pretao是填充一個9patch我想。

+0

這不提供問題的答案。要批評或要求作者澄清,請在其帖子下方留言。 – Eran

+0

@Eran請在批評答案之前三思,因爲我的回答是正確的 –