2017-08-02 3 views
-5

このタイプのxmlページをデザインしたいと思います。 私は多くのコードを試しました。新しい問題が起こるたびに。私は下部のナビゲーションバーが修正されている必要があります。グリッドビューでは、android:numColums=3android:verticalSpacingandroid:horizontalSpacingと同じです(プロファイル図ビューグリッド画像のように見えます)。このグリッドビューのXMLページはどのように設計するのですか?

XMLコード:あなたのデザインを1として

<?xml version="1.0" encoding="utf-8"?> 
<FrameLayout 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" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    tools:context=".MainSettingClass"> 

    <LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="175dp" 
    android:background="#dadada" 
    android:gravity="center" 
    android:orientation="vertical"> 

    <ImageView 
     android:id="@+id/profile_image" 
     android:layout_width="100dp" 
     android:layout_height="100dp" 
     android:src="@drawable/com_facebook_button_background"/> 

    <TextView 
     android:id="@+id/amsc_txt_fbusername" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:gravity="center" 
     android:text="TextView" 
     android:layout_marginTop="2dp" /> 

    </LinearLayout> 

    <GridView 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:id="@+id/grid_test" 
    android:verticalSpacing="2dp" 
    android:horizontalSpacing="2dp" 
    android:background="#FFFFFF" 
    android:stretchMode="columnWidth" 
    android:columnWidth="85dp" 
    android:numColumns="3"/> 

    <android.support.design.widget.BottomNavigationView 
    android:id="@+id/bottom_gallery" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_gravity="bottom" 
    android:background="#ffffff" 
    app:menu="@menu/bottom_navigation_gallery"/> 

</FrameLayout> 
+0

あなたが何をしましたか? –

+0

_私は多くのコードを試しました...あなたのコードはどこですか? –

+0

あなたが達成した努力を見せてください。 – Akshay

答えて

1

あなたはscrollview 2のために上記のコンポーネントを必要とし、あなたのBottomNavigationViewは修正(移動できない)です。

あなたのコードでは、まずはscrollviewを使用していません。なぜ、あなたはframelayoutを使用しているのかわかりません!

ここに私のコードはあなたの与えられたデザインとまったく同じです。 :)

ここに私のコードは次のとおりです。

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

    <ScrollView 
     android:id="@+id/scroll" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_above="@+id/bottom_gallery"> 

     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:orientation="vertical"> 

      <LinearLayout 
       android:id="@+id/rel_titleHolder" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:background="#dadada" 
       android:gravity="center" 
       android:orientation="vertical"> 

       <ImageView 
        android:id="@+id/profile_image" 
        android:layout_width="100dp" 
        android:layout_height="100dp" 
        android:src="@mipmap/ic_launcher" /> 

       <TextView 
        android:id="@+id/amsc_txt_fbusername" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_marginTop="2dp" 
        android:gravity="center" 
        android:text="TextView" /> 

      </LinearLayout> 

      <GridView 
       android:id="@+id/grid_test" 
       android:layout_width="match_parent" 
       android:layout_height="400dp" 
       android:columnWidth="85dp" 
       android:horizontalSpacing="2dp" 
       android:numColumns="3"/> 
     </LinearLayout> 

    </ScrollView> 

    <android.support.design.widget.BottomNavigationView 
     android:id="@+id/bottom_gallery" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:background="#ffffff" 
     android:layout_alignParentBottom="true" /> 

</RelativeLayout> 
+1

OPはなぜ "これを試してください"? **良い答え**は、何が行われたのか、なぜそれがOPのためだけでなく、将来の訪問者のためにそうした方法で行われたのかについての説明をいつも持っています。 –

+1

@bubご指導ありがとう、私はこれを確認します.. :) P.Sチェック私はすでにやった! :) –

関連する問題