2013-02-04 4 views
0

내가 안드로이드 애플 리케이션을 개발하는 "새로운"그리고 난 이제 다음과 같은 문제가 있습니다 (button.png를)안드로이드 레이아웃의 cutted 버튼 배경에서

http://puu.sh/1XpIf http://puu.sh/1XpIf

당신이 볼 수 있듯이, 버튼 배경의 작은 부분을 끊어진다. 여기에 res/layout/activity_home_screen.xml 파일 :

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    tools:context=".HomeScreen" 
    android:background="@drawable/bg_repeat" 
    android:padding="20dp" 
    android:stretchColumns="0" > 

    <TableRow 
     android:layout_margin="10dp" > 

      <Button 
       android:id="@+id/news_button" 
       android:textSize="40sp" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:background="@drawable/button" 
       android:text="@string/news_button" 

       android:onClick="gotoNews" /> 

    </TableRow> 
    <TableRow 
     android:layout_margin="10dp"> 

     <Button 
      android:id="@+id/events_button" 
      style="@style/AppBaseTheme" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:background="@drawable/button" 
      android:text="@string/events_button" 
      android:textSize="40sp" 
      android:onClick="gotoEvents" /> 

    </TableRow> 
    <TableRow 
     android:layout_width="match_parent" 
     android:layout_margin="10dp"> 

     <Button 
      android:id="@+id/nav_button" 
      style="@style/AppBaseTheme" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:background="@drawable/button" 
      android:text="@string/nav_button" 
      android:textSize="40sp" 

      android:onClick="gotoNav" /> 

    </TableRow> 
</TableLayout> 

문제점은 무엇입니까? 문제를 해결하기 위해 무엇을 할 수 있습니까?

+0

button.png를 보여줄 수 있습니까? 이미지 파일에있는 것 같습니다. – QAMAR

+0

여기에서 문제를 훨씬 잘 볼 수 있습니다. http://puu.sh/1XpIp – s3lph

+0

button.png (요청시) : _http : //puu.sh/1Xqd9_ – s3lph

답변

0

TableLayout 대신 LinearLayout을 사용해보세요.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:orientation="vertical" 
android:padding="20dp" 
tools:context=".HomeScreen" > 

<Button 
    android:id="@+id/news_button" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_margin="10dp" 
    android:onClick="gotoNews" 
    android:text="@string/news_button" 
    android:textSize="40sp" /> 

<Button 
    android:id="@+id/events_button" 
    style="@style/AppBaseTheme" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_margin="10dp" 
    android:onClick="gotoEvents" 
    android:text="@string/events_button" 
    android:textSize="40sp" /> 

<Button 
    android:id="@+id/nav_button" 
    style="@style/AppBaseTheme" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_margin="10dp" 
    android:onClick="gotoNav" 
    android:text="@string/nav_button" 
    android:textSize="40sp" /> 

+0

그게 다야! 감사. – s3lph

0

당신이

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 



    android:stretchColumns="0" > 

    <TableRow 

     > 

      <Button 
       android:id="@+id/news_button" 
       android:textSize="12sp" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:background="@drawable/button" 
       android:text="News" 

       /> 

    </TableRow> 
    <TableRow 
     android:layout_margin="10dp"> 

     <Button 
      android:id="@+id/events_button" 
      style="@style/AppBaseTheme" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:background="@drawable/button" 
      android:text="Events" 
      android:textSize="40sp" 
      /> 

    </TableRow> 
    <TableRow 
     android:layout_width="match_parent" 
     android:layout_margin="10dp"> 

     <Button 
      android:id="@+id/nav_button" 

      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:background="@drawable/button" 
      android:text="Nave" 
      android:textSize="40sp" 

      /> 

    </TableRow> 
</TableLayout> 

그것이 도움이되기를 바랍니다

검사에

을 margine을 넣었습니다 때문입니다!

+0

고마워,하지만 대답 1에서 해결책을 사용했습니다. – s3lph

관련 문제