2016-08-31 5 views
0

XML 디자인에서 두 단추 중 하나를 아무 문제없이 작동하지만 두 번째 단추는 장치에서 보이지 않습니다. (두 개의 단추는 XML의 ListView에 있습니다.) 누군가가 왜 이런 일이 일어 났는지 이해하도록 도울 수 있으면 행복 할 것이고, 고칠 수는 있습니다. 감사.장치에서 안드로이드 단추가 보이지 않음

XML은 (설정 단추가 문제 버튼입니다) -

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

<RelativeLayout 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="gg.gg.MainActivity"> 


    <TextView 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:gravity="center_horizontal" 
     android:text="Tasks" 
     android:background="#e2e2e2" /> 

    <ListView 
     android:id="@+id/list_todo" 
     tools:listitem="@layout/item_todo" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content"/> 

    <Button 
     android:layout_width="60dp" 
     android:layout_height="60dp" 
     android:src="@drawable/settings" 
     android:background="@drawable/settings" 
     android:onClick="ButtonClick" 
     android:id="@+id/settings" 
     android:layout_above="@+id/add_task" 
     android:layout_alignParentEnd="true" /> 

    <Button 
    android:layout_width="60dp" 
    android:layout_height="60dp" 
    android:id="@+id/add_task" 
    android:src="@drawable/addtask" 
    android:background="@drawable/addtask" 
    android:layout_alignParentBottom="true" 
    android:layout_alignEnd="@+id/settings" /> 

</RelativeLayout> 

+0

코드 요소에 원하는 가중치를 부여하십시오. –

+0

XML을 더미 프로젝트에 붙여 넣었습니다. 드로어 블에서 이상한 일을하지 않는다고 가정하면 둘 다 서로 위에 나타납니다. 어떤 Android 버전을보고 있습니까? –

+0

@ChrisWard API 22 – proli2

답변

0

나는 floationActionButton 무엇을 달성하려는 생각합니다. 이 밖으로 시도 : 다음과 같이

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

    <RelativeLayout 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="gg.gg.MainActivity"> 


     <TextView 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:gravity="center_horizontal" 
      android:layout_alignParentTop="true" 
      android:id="@+id/textview" 
      android:text="Tasks" 
      android:background="#e2e2e2" /> 

     <ListView 
      android:id="@+id/list_todo" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:layout_below="@+id/textview" 
      /> 

     <android.support.design.widget.FloatingActionButton 
      android:id="@+id/fab" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_gravity="bottom|end" 
      android:layout_margin="@dimen/fab_margin" 
      android:layout_alignParentBottom="true" 
      android:layout_alignParentRight="true" 
      android:src="@android:drawable/ic_dialog_email" /> 

     <android.support.design.widget.FloatingActionButton 
      android:id="@+id/fab1" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_gravity="bottom|end" 
      android:layout_margin="@dimen/fab_margin" 
      android:layout_above="@+id/fab" 
      android:layout_alignParentRight="true" 
      android:src="@android:drawable/ic_dialog_email" /> 
    </RelativeLayout> 
    </FrameLayout> 
+0

여전히 같은 문제입니다. – proli2

+0

제 편집보기. 들어보세요. – Nidhi

1

enter image description here 레이아웃이 있어야한다 :

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

     <RelativeLayout 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="gg.gg.MainActivity"> 


      <TextView 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:gravity="center_horizontal" 
       android:layout_alignParentTop="true" 
       android:id="@+id/textview" 
       android:text="Tasks" 
       android:background="#e2e2e2" /> 

      <ListView 
       android:id="@+id/list_todo" 
       tools:listitem="@layout/item_todo" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:layout_above="@+id/linearlayout" 
       android:layout_below="@+id/textview" 
       /> 

      <LinearLayout 
       android:id="@+id/linearlayout" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_alignParentBottom="true" 
       android:orientation="vertical" 
       > 
      <Button 
       android:layout_width="60dp" 
       android:layout_height="60dp" 
       android:src="@drawable/settings" 
       android:background="@drawable/settings" 
       android:onClick="ButtonClick" 
       android:id="@+id/settings" 

       /> 

      <Button 
       android:layout_width="60dp" 
       android:layout_height="60dp" 
       android:id="@+id/add_task" 
       android:src="@drawable/addtask" 
       android:background="@drawable/addtask" 

       /> 
      </LinearLayout> 
     </RelativeLayout> 
+0

죄송하지만 여전히 문제를 해결하지 못합니다. – proli2

+0

@ proli2 괜찮습니다. 스크린 샷도 첨부했습니다. – Rajendra

0

사용이를위한 동작 버튼을 부동.

+0

아직 아무것도 : ( – proli2

+0

레이아웃을 보냅시다. –

+0

플로팅 버튼이나 간단한 버튼을 원하십니까? –

0
<?xml version="1.0" encoding="utf-8"?> 

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
      xmlns:mapbox="http://schemas.android.com/apk/res-auto" 
      xmlns:tools="http://schemas.android.com/tools" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      tools:context=".HomeActivity"> 

<include 
    android:id="@+id/toolbar" 
    layout="@layout/toolbar" /> 



<LinearLayout 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentRight="true" 
    android:layout_centerVertical="true" 
    android:orientation="vertical"> 

    <ImageView 
     android:id="@+id/parking" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_marginRight="6dp" 
     android:src="@mipmap/parking_locs" /> 

    <ImageView 
     android:id="@+id/roads" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_marginRight="6dp" 
     android:layout_marginTop="10dp" 
     android:src="@mipmap/before_park_car" /> 

</LinearLayout> 

<ImageView 
    android:id="@+id/compass" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentBottom="true" 
    android:layout_alignParentRight="true" 
    android:layout_margin="10dp" 
    android:src="@mipmap/button_my_location" /> 
</RelativeLayout> 
+0

버튼을 추가해보십시오. –

관련 문제