How to use HTML or CSS in Android Studio?

1

I would like to know how I can structure my app with HTML, and style it with CSS too. I want to put a fieldset to form a table. I looked for tutorials on the internet but I did not quite understand how to use it.

I want the lvDolar, from the XML below, to be bypassed by a fieldset:

<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" android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:paddingBottom="@dimen/activity_vertical_margin"
    tools:context="com.example.teste.application.VerDolar"
    android:background="@color/white">

    <ListView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        **android:id="@+id/lvDolar"**
        android:layout_alignParentBottom="true"
        android:layout_alignParentStart="true"
        android:layout_marginBottom="0dp" />
</RelativeLayout>

This is my java class:

package teste;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import com.example.rainah.application.R;

import java.util.List;


public class VerDolar extends ActionBarActivity {

    private ListView lvDolar;
    private List<Dolar> dolar;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_ver_dolar);
        setTitle("Dolar");

        lvDolar = (ListView) findViewById(R.id.lvDolar);
    }

    @Override
    protected void onResume() {
        super.onResume();

        DbHelper db = new DbHelper(this);
        List<Dolar> listDolar = db.selectDolar();

        ArrayAdapter<Dolar> list = new ArrayAdapter<Dolar>(this, android.R.layout.simple_list_item_1, listDolar);

        lvDolar.setAdapter(list);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.menu_ver_dolar, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        //int id = item.getItemId();

        //noinspection SimplifiableIfStatement
        switch(item.getItemId()) {
            case R.id.action_search:
                break;
            case R.id.action_new:
                Intent intent = new Intent(this, AddDolar.class);
                startActivity(intent);
                break;
            default:
                return true;
        }
        return super.onOptionsItemSelected(item);
    }
}

Thanks, if anyone can help me, because I think it's a relatively simple question, but I'm breaking my heart to understand how this works in android studio. Thanks in advance.

    
asked by anonymous 27.10.2016 / 19:17

2 answers

2

To use CSS in an Android application, you must have your entire application inside a WebView, that is, you can not make the components defined in the XML of an Activity take the style of a CSS.

The style applied to an Activity (or its elements) must be programmed in the Activity XML itself or in a separate xml (usually the styles.xml).

To actually use CSS, rewrite your application into an HTML "application" and Android use a WebView to display the HTMLs of your application. (see the 3rd link for references). To create HTML "applications", you can use PhongeGap or Ionic, which has good community support and to program require knowledge of HTML, CSS and Javascript (Angular).

Finishing: To solve your problem in fact, which is to put a fieldset around the field, there are a few alternatives: - add a TextView behind the component, without text, a little larger than the component to simulate the border; - add a "shape" around the component; - add a Bitmap behind the component.

References:

link

link

>

link

link

link

    
27.10.2016 / 20:49
-1

Android studio is focused on developing native applications, to use HTML and CSS I suggest using CORDOVA, for the development of hybrid applications, a suggestion also rather than developing the responsive layout, which gives a certain work, try using a market framework I suggest IONIC

Link:

link

link

    
02.06.2017 / 20:46