滚动视图中的可展开列表视图未显示所有标题标题

时间:2016-02-10 19:14:04

标签: java android

因此,今天创建了可扩展列表视图,在Scroll视图中实现了它,但我只能从parent_layout中看到一个标题(标题)。你会在第一张图片中看到它:

slika1

但有4个标题。

第二个问题,乳清我扩展了列表,其他标题出现了,但是当除了最后一个之外都扩展了所有标题时,你看不到标题:

slika2

你可以在它的底部看到一张图片。

第三个问题,如何将箭头重新定位到右边并改变颜色?那张箭头在前面的图片中盘旋了。

这是我的代码:

适配器

import android.content.Context;
import android.graphics.Typeface;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseExpandableListAdapter;
import android.widget.TextView;

import java.util.HashMap;
import java.util.List;

/**
 * Created by dario on 10.02.16..
 */
public class Adapter531 extends BaseExpandableListAdapter {

    private List<String> header_titles;
    private HashMap<String, List<String>> child_titles;
    private Context ctx;
    Adapter531(Context ctx, List<String> header_titles, HashMap<String, List<String>> child_titles){
        this.ctx = ctx;
        this.child_titles = child_titles;
        this.header_titles = header_titles;
    }

    @Override
    public int getGroupCount() {
        return header_titles.size();
        //vraća kolko parenta imaš
    }

    @Override
    public int getChildrenCount(int groupPosition) {
        return child_titles.get(header_titles.get(groupPosition)).size();
        //vraća broj child itema u svakom headingu
    }

    @Override
    public Object getGroup(int groupPosition) {
        return header_titles.get(groupPosition);
    }

    @Override
    public Object getChild(int groupPosition, int childPosition) {
        return child_titles.get(header_titles.get(groupPosition)).get(childPosition);
    }

    @Override
    public long getGroupId(int groupPosition) {
        return groupPosition;
    }

    @Override
    public long getChildId(int groupPosition, int childPosition) {
        return childPosition;
    }

    @Override
    public boolean hasStableIds() {
        return false;
    }

    @Override
    public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
        String title = (String)this.getGroup(groupPosition);
        if(convertView == null){
            LayoutInflater layoutInflater = (LayoutInflater)this.ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            convertView = layoutInflater.inflate(R.layout.parent_531_layout, null);
        }
        TextView textView = (TextView) convertView.findViewById(R.id.heading_item);
        textView.setTypeface(null, Typeface.BOLD);
        textView.setText(title);

        return convertView;
    }

    @Override
    public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) {
        String title = (String)this.getChild(groupPosition, childPosition);
        if (convertView == null){
            LayoutInflater layoutInflater = (LayoutInflater)this.ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            convertView = layoutInflater.inflate(R.layout.child_531_layout, null);
        }

        TextView textView = (TextView) convertView.findViewById(R.id.child_item);
        textView.setText(title);

        return convertView;
    }

    @Override
    public boolean isChildSelectable(int groupPosition, int childPosition) {
        return true;
    }
}

Java文件

import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ExpandableListAdapter;
import android.widget.ExpandableListView;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

public class ProgramiPowerlifting531 extends AppCompatActivity {
    ExpandableListView expandableListView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_programi_powerlifting531);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);

        Intent intent = getIntent();

        expandableListView = (ExpandableListView) findViewById(R.id.exp_listview531);
        List<String> Headings = new ArrayList<String>();
        List<String> L1 = new ArrayList<String>();
        List<String> L2 = new ArrayList<String>();
        List<String> L3 = new ArrayList<String>();
        List<String> L4 = new ArrayList<String>();
        HashMap<String, List<String>> ChildList = new HashMap<String, List<String>>();
        String heading_items[] = getResources().getStringArray(R.array.header_titles);
        String l1[] = getResources().getStringArray(R.array.h1_items);
        String l2[] = getResources().getStringArray(R.array.h2_items);
        String l3[] = getResources().getStringArray(R.array.h3_items);
        String l4[] = getResources().getStringArray(R.array.h4_items);

        for (String title : heading_items) {
            Headings.add(title);
        }
        for (String title : l1) {
            L1.add(title);
        }
        for (String title : l2) {
            L2.add(title);
        }
        for (String title : l3) {
            L3.add(title);
        }
        for (String title : l4) {
            L4.add(title);
        }

        ChildList.put(Headings.get(0), L1);
        ChildList.put(Headings.get(1), L2);
        ChildList.put(Headings.get(2), L3);
        ChildList.put(Headings.get(3), L4);
        Adapter531 adapter531 = new Adapter531(this, Headings, ChildList);
        expandableListView.setAdapter(adapter531);
        expandableListView.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {
            @Override
            public boolean onGroupClick(ExpandableListView parent, View v,
                                        int groupPosition, long id) {
                setListViewHeight(parent, groupPosition);
                return false;
            }
        });
    }
        private void setListViewHeight(ExpandableListView listView,
        int group) {
            ExpandableListAdapter listAdapter = (ExpandableListAdapter) listView.getExpandableListAdapter();
            int totalHeight = 0;
            int desiredWidth = View.MeasureSpec.makeMeasureSpec(listView.getWidth(),
                    View.MeasureSpec.EXACTLY);
            for (int i = 0; i < listAdapter.getGroupCount(); i++) {
                View groupItem = listAdapter.getGroupView(i, false, null, listView);
                groupItem.measure(desiredWidth, View.MeasureSpec.UNSPECIFIED);

                totalHeight += groupItem.getMeasuredHeight();

                if (((listView.isGroupExpanded(i)) && (i != group))
                        || ((!listView.isGroupExpanded(i)) && (i == group))) {
                    for (int j = 0; j < listAdapter.getChildrenCount(i); j++) {
                        View listItem = listAdapter.getChildView(i, j, false, null,
                                listView);
                        listItem.measure(desiredWidth, View.MeasureSpec.UNSPECIFIED);

                        totalHeight += listItem.getMeasuredHeight();

                    }
                }
            }

            ViewGroup.LayoutParams params = listView.getLayoutParams();
            int height = totalHeight
                    + (listView.getDividerHeight() * (listAdapter.getGroupCount() - 1));
            if (height < 10)
                height = 200;
            params.height = height;
            listView.setLayoutParams(params);
            listView.requestLayout();

        }

    }

活动XML

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <ExpandableListView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/exp_listview531"
        >

    </ExpandableListView>
</LinearLayout>

父XML

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

    <TextView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:text="Prvo"
        android:id="@+id/heading_item"
        android:layout_marginLeft="10dp"
        android:layout_marginTop="10dp" />
</LinearLayout>

儿童XML

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

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:text="Jel radi?"
        android:id="@+id/child_item"
        android:layout_marginTop="10dp"
        android:layout_marginLeft="10dp"
        android:textColor="#424242" />
</LinearLayout>

的字符串

<string-array name="header_titles">
    <item>\t\t\t\t\tPonedjeljak - čučanj</item>
    <item>\t\t\t\t\tUtorak - potisak s klupe</item>
    <item>\t\t\t\t\tČetvrtak - mrtvo dizanje</item>
    <item>\t\t\t\t\tPetak - potisak iznad glave</item>

</string-array>

<string-array name="h1_items">
    <item>1. Čučanj, 3 serije</item>
    <item>\t\t1. tjedan - 3 x 5 (65, 75, 85% 1RM)</item>
    <item>\t\t2. tjedan - 3 x 3 (70, 80, 90% 1RM)</item>
    <item>\t\t3. tjedan - 3 x 5/3/1 (75, 85, 95% 1RM)</item>
    <item>\t\t4. tjedan - 3 x 5 (40, 50, 60%)</item>
    <item>2. Nožna ekstenzija, 5 x 10</item>
    <item>3. Nožna fleksija, 5 x 10</item>
</string-array>
<string-array name="h2_items">
    <item>1. Potisak s klupe, 3 serije</item>
    <item>\t\t1. tjedan - 3 x 5 (65, 75, 85% 1RM)</item>
    <item>\t\t2. tjedan - 3 x 3 (70, 80, 90% 1RM)</item>
    <item>\t\t3. tjedan - 3 x 5/3/1 (75, 85, 95% 1RM)</item>
    <item>\t\t4. tjedan - 3 x 5 (40, 50, 60%)</item>
    <item>2. Potisak s kose klupe, 5 x 10</item>
    <item>3. Razvlačenje kablovima, 5 x 10</item>
</string-array>
<string-array name="h3_items">
    <item>1. Mrtvo dizanje, 3 serije</item>
    <item>\t\t1. tjedan - 3 x 5 (65, 75, 85% 1RM)</item>
    <item>\t\t2. tjedan - 3 x 3 (70, 80, 90% 1RM)</item>
    <item>\t\t3. tjedan - 3 x 5/3/1 (75, 85, 95% 1RM)</item>
    <item>\t\t4. tjedan - 3 x 5 (40, 50, 60%)</item>
    <item>2. Veslanje u pretklonu, 5 x 10</item>
    <item>3. Povlačenja na lat mašini, 5 x 10</item>
</string-array>
<string-array name="h4_items">
    <item>1. Potisak iznad glave, 3 serije</item>
    <item>\t\t1. tjedan - 3 x 5 (65, 75, 85% 1RM)</item>
    <item>\t\t2. tjedan - 3 x 3 (70, 80, 90% 1RM)</item>
    <item>\t\t3. tjedan - 3 x 5/3/1 (75, 85, 95% 1RM)</item>
    <item>\t\t4. tjedan - 3 x 5 (40, 50, 60%)</item>
    <item>2. Francuski potisak, 5 x 10</item>
    <item>3. Pregib za biceps, 5 x 10</item>
</string-array>

活动XML

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

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:paddingBottom="10dp"
    android:paddingLeft="10dp"
    android:paddingRight="10dp"
    android:paddingTop="10dp"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    tools:context="hr.app.liftme.liftmehr.ProgramiPowerlifting531"
    tools:showIn="@layout/activity_programi_powerlifting531"
    android:background="#eeeeee"
    android:orientation="vertical">


    <android.support.v7.widget.CardView
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:card_view="http://schemas.android.com/apk/res-auto"
        android:foreground="?android:attr/selectableItemBackground"
        android:clickable="false"
        android:id="@+id/Osnivac"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        card_view:cardCornerRadius="2dp"
        android:layout_alignParentTop="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_marginBottom="10dp"
        android:layout_weight="1"
        card_view:cardBackgroundColor="#ffffff">

    <LinearLayout
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="10dp"
        android:id="@+id/linearLayout14"
        android:layout_marginTop="50dp"
        android:padding="7dp">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:text="Osnivač programa"
            android:id="@+id/textView7"
            android:layout_marginBottom="5dp"
            android:textStyle="bold" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:text="Osnivač ovog programa je Jim Wendler, powerlifter koji je na vrhu svoje karijere podigao 455kg u čučnju pa mu očito možemo vjerovati da zna o čemu govori i da program djeluje."
            android:id="@+id/textViewOsnivačPrograma"
            android:layout_marginBottom="5dp" />

        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/imageView3"
            android:background="@mipmap/slika_programi_pl_531_jimwendler"
            android:layout_gravity="center_horizontal" />

    </LinearLayout>

    </android.support.v7.widget.CardView>

    <android.support.v7.widget.CardView
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:card_view="http://schemas.android.com/apk/res-auto"
        android:foreground="?android:attr/selectableItemBackground"
        android:clickable="false"
        android:id="@+id/Osnove"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        card_view:cardCornerRadius="2dp"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_weight="1"
        android:layout_marginBottom="10dp"
        android:elevation="50dp"
        card_view:cardBackgroundColor="#ffffff">

    <LinearLayout
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/linearLayout15"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_below="@+id/linearLayout14"
        android:layout_marginBottom="10dp"
        android:padding="7dp">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:text="5/3/1 osnove"
            android:id="@+id/textView8"
            android:layout_marginBottom="5dp"
            android:textStyle="bold" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:text="abc "
            android:id="@+id/textView531osnove" />
    </LinearLayout>

    </android.support.v7.widget.CardView>

    <android.support.v7.widget.CardView
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:card_view="http://schemas.android.com/apk/res-auto"
        android:foreground="?android:attr/selectableItemBackground"
        android:clickable="false"
        android:id="@+id/Izgled"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        card_view:cardCornerRadius="2dp"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_weight="2.90"
        android:layout_marginBottom="10dp"
        android:elevation="10dp"
        card_view:cardBackgroundColor="#ffffff">

    <LinearLayout
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/linearLayout15"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_marginBottom="10dp"
        android:id="@+id/linearLayout16"
        android:padding="7dp">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:text="Izgled programa"
            android:id="@+id/textView9"
            android:layout_marginBottom="5dp"
            android:textStyle="bold" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:text="U osnovi program izgleda ovako:\n\n
1.  tjedan: 3 x 5\n
2.  tjedan: 3 x 3\n
3.  tjedan: 3 x 5,3,1\n
4.  tjedan: deload (tjedan za oporavak)\n\n
* prvi broj označava broj serija, a drugi označava broj ponavljanja\n\n
Postoci svakog tjedna izgledaju ovako:\n
"
            android:id="@+id/textViewIzgledPrograma" />

        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/imageView"
            android:background="@mipmap/tablica_531_postoci"
            android:layout_weight="1" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:text="\n* + označava da se od osobe očekuje da prekorači zadan broj ponavljanja
\n\nNakon završena 4 tjedan potrebno je na sadašnji maksimum (u našem primjeru 180kg) dodati 5lbs (2.5kg) na potisak s klupe i potisak iznad glave te 10lbs (4.5kg) na čučanj i mrtvo dizanje. Vrlo je važno da ne nadodajete više od propisanog na kraju ciklusa jer će to nakon nekoliko mjeseci dovesti do stagnacije napretka.
"
            android:id="@+id/textViewIzgledProgramaNastavak" />


    </LinearLayout>
    </android.support.v7.widget.CardView>


    <android.support.v7.widget.CardView
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:card_view="http://schemas.android.com/apk/res-auto"
        android:foreground="?android:attr/selectableItemBackground"
        android:clickable="false"
        android:id="@+id/DodatneVjezbe"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        card_view:cardCornerRadius="2dp"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_weight="2.90"
        android:layout_marginBottom="10dp"
        android:elevation="10dp"
        card_view:cardBackgroundColor="#ffffff">


    <LinearLayout
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/linearLayout16"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:id="@+id/linearLayout17"
        android:layout_marginBottom="10dp"
        android:padding="7dp">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:text="Dodatne vježbe"
            android:id="@+id/textView10"
            android:layout_marginBottom="5dp"
            android:textStyle="bold" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:text="Svrha dodatnih vježbi je prebroditi slabosti i stvoriti dodatnu ravnotežu. Za svaki od dana potrebno je raditi nekoliko dodatnih vježbi. One variraju kod svakog pojedinca.
\n\nNeki od primjera:
\n\nDodatne vježbe za čučanj: prednji čučanj, dobro jutro, iskoraci s bučicama ili šipkom, nožna fleksija, nožna ekstenzija, ekstenzija za leđa.
\n\nDodatne vježbe za potisak s klupe: potisak s kose klupe šipkom ili bučicama, razvlačenje bučicama ili kablovima, propadanja.
\n\nDodatne vježbe za mrtvo dizanje: rumunjsko mrtvo dizanje, obrnuta hiperekstenzija, ekstenzija za leđa.
\n\nDodatne vježbe za potisak iznad glave: sljeganje ramenima, pregib za biceps bučicama ili šipkom, francuski potisak, hammer pregib, obrnuti pregib šipkom.
"
            android:id="@+id/textView11" />

    </LinearLayout>
    </android.support.v7.widget.CardView>

    <android.support.v7.widget.CardView
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:card_view="http://schemas.android.com/apk/res-auto"
        android:foreground="?android:attr/selectableItemBackground"
        android:clickable="false"
        android:id="@+id/PrimjerPrograma"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        card_view:cardCornerRadius="2dp"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_weight="2.90"
        android:layout_marginBottom="10dp"
        android:elevation="10dp"
        card_view:cardBackgroundColor="#ffffff">

    <LinearLayout
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/linearLayout17"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:id="@+id/linearLayout18"
        android:layout_marginBottom="10dp"
        android:padding="7dp">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:text="Primjer programa"
            android:id="@+id/textView12"
            android:layout_marginBottom="5dp"
            android:textStyle="bold" />


        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <ExpandableListView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:id="@+id/exp_listview531"
                >

            </ExpandableListView>
        </LinearLayout>

    </LinearLayout>
    </android.support.v7.widget.CardView>

    <android.support.v7.widget.CardView
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:card_view="http://schemas.android.com/apk/res-auto"
        android:foreground="?android:attr/selectableItemBackground"
        android:clickable="true"
        android:id="@+id/DodatneNapomene"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        card_view:cardCornerRadius="2dp"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_weight="2.90"
        android:elevation="10dp"
        card_view:cardBackgroundColor="#ffffff">

    <LinearLayout
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@+id/linearLayout18"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_marginBottom="10dp"
        android:padding="7dp">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:text="Dodatne napomene"
            android:id="@+id/textView13"
            android:textStyle="bold"
            android:layout_marginBottom="5dp" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:text="Pročitajte kako se pravilno izvode vježbe – u našoj aplikaciji detaljno je objašnjeno kako se svaka od vježbi s kojom ćete se susresti u ovom programu izvodi.
\n\nForma iznad svega – dobra forma omogućit će podizanje većih tereta i čuva zdravlje osobe čiji je cilj da postane što jaća, ne da postane invalid.
\n\nDugoročni plan – ovaj program testiran je na tisućama ljudi diljem svijeta i zasigurno funkcionira te je stvoren za dugoročno korištenje.

\n\nOdmor - odmori između serija kod glavnih vježbi traju od 3 do 5 minuta, ovisno koliko je osobi potrebno da može ponovno dizati kilaže koje su joj blizu maksimuma. Za dodatne vježbe 2 minute. Ako osoba nije spremna nakon dvije minute treba smanjiti kilažu.
\n\nZagrijavanje - za uspješno odrađen trening potrebno je razgibati se, povisiti brzinu rada srca i odraditi nekoliko serija glavnih vježbi s manjim kilažama.
"
            android:id="@+id/textView14" />
    </LinearLayout>
    </android.support.v7.widget.CardView>


</LinearLayout>
</ScrollView>

2 个答案:

答案 0 :(得分:3)

Android建议不要在ScrollViews中使用ListViews等因为它们本身已经有滚动功能,但有时你需要这样的功能(就像你的那样)...所以你必须在渲染之前计算你的Expandable或ListViews高度完成滚动...

here就是这样做的。

对于您的第二个问题,将指示器更改为右侧.. 您可以修改适配器中的布局并使用自定义图像并隐藏并根据单击here显示它 或者您可以使用内部方法计算和重新定位它

setIndicatorBounds(int, int)
setIndicatorBoundsRelative(int, int)

例如here

答案 1 :(得分:0)

问题的解决方案并非所有标题都显示: 将ExpandableListView的高度设置为特定内容,例如200dp,而不是wrap_content, fill_parent or match_parent