2017-09-29 13 views
1

よりも低いこの1は、この中にゼリービーンで撮影された画像が示され、メニュー内のテキストがされていないデバイスで適切に動作していませんCardviewこのスクリーンショットは、マシュマロ</p> <p><a href="https://i.stack.imgur.com/wSvX4.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wSvX4.jpg" alt="enter image description here"></a></p> <p>に取り込まれるロリポップ

enter image description here

見えない私は、親ビューとしてCardviewとレイアウトを持っています。

イメージとテキストで構成されています。

: は今のレイアウトは、画像がproperly.Theyが小さいオンにし、完全にここ

だ私のレイアウトXMLファイルをカードビューに一致していません示されていないAndroidのMとし、上記のデバイス上ではなく、(Jellybeanのような)下のバージョンで正常に動作します

<android.support.v7.widget.CardView 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_margin="3dp" 
      app:cardPreventCornerOverlap="false" 
      android:elevation="2dp"> 

      <LinearLayout 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:gravity="center_vertical" 
       android:orientation="horizontal"> 

       <android.support.v7.widget.CardView 
        android:layout_width="80dp" 
        android:layout_height="80dp"> 

        <ImageView 
         android:id="@+id/home_news_image" 
         android:layout_width="80dp" 
         android:layout_height="80dp" 
         android:layout_gravity="center_vertical" 
         android:scaleType="centerCrop" 
         android:src="@drawable/jesus" /> 
       </android.support.v7.widget.CardView> 

       <LinearLayout 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_marginLeft="5dp" 
        android:gravity="center_vertical" 
        android:orientation="vertical"> 

        <TextView 
         android:id="@+id/home_title_parish_news" 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:layout_marginTop="5dp" 
         android:paddingLeft="1dp" 
         android:text="Christmas Celebration" 
         android:textSize="14dp" 
         android:textStyle="bold" /> 

        <TextView 
         android:id="@+id/home_short_description" 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:ellipsize="end" 
         android:maxLines="1" 
         android:padding="3dp" 
         android:text="hi this is to tell thlkdsa asdsag slk sg sdg sdgjs gsd gsg jglsgja gasjggjasg asgjasgj sgjasg g g" 
         android:textSize="12dp" /> 

        <TextView 
         android:id="@+id/home_date_published" 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:layout_marginRight="10dp" 
         android:gravity="right|bottom" 
         android:padding="3dp" 
         android:text="10/10/2010" 
         android:textSize="8dp" /> 
       </LinearLayout> 
      </LinearLayout> 
     </android.support.v7.widget.CardView> 

これは、私は、テキストが表示されていない画像の下にテキストを配置する場合、私はまた私のレイアウトとビュー

public class MenuAdapter extends BaseAdapter { 

    Context mContext; 
    ArrayList<MenuModel> list; 
    String img; 


    public MenuAdapter(Context c, ArrayList<MenuModel> list) { 
     mContext = c; 
     this.list = list; 

    } 

    @Override 
    public int getCount() { 
     return list.size(); 
    } 

    @Override 
    public Object getItem(int i) { 
     return i; 
    } 

    @Override 
    public long getItemId(int i) { 
     return i; 
    } 

    @Override 
    public View getView(int i, View view, ViewGroup viewGroup) { 
     View grid; 
     LayoutInflater inflater = (LayoutInflater) mContext 
       .getSystemService(Context.LAYOUT_INFLATER_SERVICE); 
     if (view == null) { 
      grid = inflater.inflate(R.layout.home_grid_menu, null); 
      TextView textView = (TextView) grid.findViewById(R.id.home_grid_text); 
      ImageView imageView = (ImageView) grid.findViewById(R.id.home_grid_image); 
      textView.setText(list.get(i).getMenuName()); 
      imageView.setImageResource(list.get(i).getMenuImage()); 

     } else { 
      grid = (View) view; 
     } 

     return grid; 
    } 
} 

を初期化するアダプタです。

どうか私に教えてください。私は今、私はいくつかの解決策

+0

を使用してテキストを共有することができ、両方の画像を添付してください。 –

+0

framelayoutでcardviewをラップしてみてください(線形とカードビューの間に追加してください)。 – Jimmy

+0

レイアウトを初期化するコードはどこですか? DeKaNszn @ – DeKaNszn

答えて

0

カードビューが適切にロリポップを開始する働き得ることを願っています

、彼らは後方支援を持っていますが、レンダリングは、通常は同じではありません。あなたはここアンドロイド内の資産フォルダからファイルを読み込む必要がある特定の問題の両方の画面の画像を添付してください

1

まずに関して

は、資産フォルダ

InoutInputStream is = getAssets().open("yourfile.html"); 
int size = is.available(); 

byte[] buffer = new byte[size]; 
is.read(buffer); 
is.close(); 
String str = new String(buffer); 

からhtmlファイルを読み取る方法の例であります文字列にhtmlファイルがあり、HTML.fromhtmlを使用してhtmlファイルからテキストを取得する必要があります。

String htmltext=Html.fromHtml(Html.fromHtml(str).toString()) 

あなたがHTMLテキストを共有する場合、あなたは、Androidの意図に

Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND); 
    sharingIntent.setType("text/plain"); 
    sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Sharing html Text"); 
    sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, htmltext); 
    startActivity(Intent.createChooser(sharingIntent, "Select")); 
+0

に質問を参照してください。この質問は、HTML – DeKaNszn

+0

を開くことに関するものではありません、私はこれは私の質問@Muhammad とは無関係であると考えて私の質問を読んでください お返事ありがとうございます – Jeyaseelan

関連する問題

 関連する問題