Rahmen um gleiche Einträge in einer ListView

kukuk

kukuk

App-Anbieter (kostenlos)
29
Ich stehe gerade vor der Aufgabe von gleichen Einträgen in einer ListView einen "Rahmen" drum zu ziehen. Hat da jemand einen Lösungs Ansatz, wie ich das am besten machen kann? Ich arbeite mit einer CustomListView, sodass ich für jedes Element meine List_Row_Layout.xml nehme.
Mit dem Customdivider(View) bekomme ich zumindest schonmal oben einen Linie hin, jedoch reicht mir das nicht.

Code:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:background="#000100"
    android:minHeight="50dp"
    android:orientation="horizontal"
    android:padding="5dip" >

    <View
        android:id="@+id/customdivider"
        android:layout_width="fill_parent"
        android:layout_height="1dp"
        />
    <TableLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <TableRow
            android:id="@+id/tableRow1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >

            <TableLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" >

                <TableRow
                    android:id="@+id/tableRow5"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" >

                    <TextView
                        android:id="@+id/title"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:textColor="#FFFFFF"
                        android:textStyle="bold"
                        android:typeface="sans" />
                </TableRow>

                <TableRow
                    android:id="@+id/tableRow6"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" >

                    <TextView
                        android:id="@+id/reporter"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="5dip"
                        android:textColor="#FFFFFF"
                        android:textSize="12sp" />
                </TableRow>

                <TableRow
                    android:id="@+id/tableRow7"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" >

                    <TextView
                        android:id="@+id/date"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:textColor="#FFFFFF"
                        android:textSize="12sp" />

                </TableRow>

                <TableRow
                    android:id="@+id/tableRow8"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" >
                     <TextView
                        android:id="@+id/kategorie"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:textColor="#FFFFFF"
                        android:textSize="12sp" />
                </TableRow>
            </TableLayout>
        </TableRow>

        <TableRow
            android:id="@+id/tableRow2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >
        </TableRow>

        <TableRow
            android:id="@+id/tableRow3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >
        </TableRow>

        <TableRow
            android:id="@+id/tableRow4"
            android:layout_width="wrap_content"

            android:layout_height="wrap_content" >
        </TableRow>
    </TableLayout>

</RelativeLayout>
 
Ach unser Layout-Künstler :)
Win10 Schock überwunden ? :)

Habe ich es richtig verstanden , dass du in einem CustomView an bestimmten Positionen den Background so verändern möchtest, dass er einen "Rahmen" um den Content malt , damit der User auch sieht , hier ist was doppelt ???

Wenn ja :

IDEE : Du könntest dir ein hidden element nehmen und das einem shape zuordnen (auf Z-order achten)

<shape xmlns:android="http://schemas.android.com/apk/res/android">

<solid android:color="@android:color/transparent"/>
<solid android:color="#2281CEF9"/>

/>
<corners android:radius="10dp" />
<stroke
android:width="1dp"
android:color="#88FFFFFF"/>

</shape>

Zur laufzeit machste dann ein visible / invisible drauf


Und möchtest du das Shape zur Laufzeit ändern

GradientDrawable bgShapeG = (GradientDrawable)myhiddenelement.getBackground();
bgShapeG.setColor (Mycolor);
bgShapeG.setStroke(1, Mycolor));
 
Zuletzt bearbeitet:
  • Danke
Reaktionen: kukuk
Nach unzähligen rumprobieren habe ich es endlich hinbekommen gleiche Einträge einzurahmen. Jetzt habe ich das Problem, dass die Rahmen immer komplett rum sind. Ich wollte mir jetzt 2 verschiedene Border_shapes machen. Bei dem einen ist oben offen. Bei dem anderen ist unten offen.
Kann mir da noch jemand verraten wie das funktioniert?

bgShapeG.setStroke(Global.rahmen_dicke, Global.rahmen_farbe);

Code:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
    <!-- use this for transparent -->
    <!-- <solid android:color="#00000000" /> -->
    <!-- use this for a background colour -->

    <solid android:color="#FFF" />
    <stroke android:width="2dip" android:color="#FF0000" />
</shape>
 

Ähnliche Themen

A
Antworten
10
Aufrufe
1.022
swa00
swa00
D
  • Data2006
Antworten
14
Aufrufe
493
jogimuc
J
OnkelLon
Antworten
13
Aufrufe
1.986
OnkelLon
OnkelLon
Zurück
Oben Unten