android-layout

How to make dynamic text bold having tag <b> </b> in listview?

青春壹個敷衍的年華 提交于 2020-01-07 04:37:07
问题 I'm developing an application in which I'm parsing JSON data and fixing the result in the listview. In JSON response I'm getting the following response: { "searchdata": { "webresult": [ { "title": "<b>Android</b>", "desc": "Discover a new flavor of Jelly Bean <b>Android</b> 4.2 introduces a completely new camera experience, a new form of typing that helps you power ...", "link": "http://www.android.com/" }, { "title": "<b>Android</b> (operating system) - Wikipedia, the free encyclopedia",

Layout dynamic grid in middle

霸气de小男生 提交于 2020-01-07 04:29:09
问题 I have a grid with (currently) four cells wide. Each cell I am specifying to be 20px wide. I want to position this in the middle and at the top of a portrait layout. My code is below. My problem is that hte grid seems to fill the whole width whereas it want it to just take number of columns * column width only. And for white space around it. I've put colours on each of the components to try and make it easy to see where each one is. The two views in the first LinearLayout are never shown. Ive

How add a webview to a layout that have more widgets

大憨熊 提交于 2020-01-07 04:28:13
问题 I want to add a webview to my layout.But that layout have few other widgets also.But when i run the application webview takes the entire screen and other widgets get disappear.here is my layout page.xml.... <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:id="@+id/linearLayout1" android:layout_width="fill_parent" android:layout_height="fill_parent" > <WebView android:layout_width="match_parent" android:layout_height="200dp"

Common class for elements in include layout

帅比萌擦擦* 提交于 2020-01-07 04:24:17
问题 I have a layout toolbar which I use in every pages using in xml. There are some buttons in this layout and I want to create a class which takes care of the button clicks of the buttons in toolbar.xml . Is this possible? If yes how? This is my code of the xml file: <?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="wrap_content" android:orientation="vertical">

Android Floating Action Button doesn't get fixed at the bottom

Deadly 提交于 2020-01-07 03:53:09
问题 I have a fragment wich renders a recycleview with an floating action buttom. The problem is that when the list is empty, the fab keeps on the right top, when the list has few items, the fab keeps bellow the list but not at the bottom, and it only keeps totatly at the bottom when the list fill the screen with items. Could somebody help me please? Bellow is my code: <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com

how to set button color in dialog box

谁说我不能喝 提交于 2020-01-07 03:15:51
问题 i have created a dialog box which has "accept" and "reject" buttons, but the color of the button is in default color. can anyone provide the code to set the color of the buttons in green and red. 回答1: By creating a custom drawable.. for example.. button.setBackgroundResource(R.drawable.custom_button); custom_button.xml <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <shape android:shape="rectangle"> <corners android:radius

How to create android spinner without down triangle on the right side of the widget with bottom line

笑着哭i 提交于 2020-01-07 03:15:19
问题 I want to remove down triangle on the right side and wants to bottom line. I am using following code to add bottom line: <Spinner android:id="@+id/buttonSelectCountry" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="10dp" android:gravity="center" android:spinnerMode="dropdown" android:text="Select country" style="@style/Widget.AppCompat.Spinner.Underlined"/> and following code to remove down arrow: <Spinner android:id="@+id

AppCompat does not support the current theme features

一世执手 提交于 2020-01-07 03:07:24
问题 Studio gives me error like below . How can I solve this? I tried other solutions . But they dont work. emulator's API : 21 . All Other API's works. But in this gives me error . When I click an item in the Navigation drawer menu , it crashes Error Output : java.lang.RuntimeException: Unable to start activity ComponentInfo{com.dd.myApplicaiton/com.d.myapplication.category.CategoryActivityDialog}: java.lang.IllegalArgumentException: AppCompat does not support the current theme features: {

How to make onTouch works like onTap in Android?

夙愿已清 提交于 2020-01-07 02:44:11
问题 I've implemented an OnTouchListener in my MapActivity and of course I had to override the onTouch() method. I want it to fire only when I tap on the map - otherwise I can't even move the map. Here's my onTouch method: @Override public boolean onTouch(View v, MotionEvent e) { if (e.getAction() == MotionEvent.ACTION_DOWN) { // SOME ACTIONS ... } return true; } 回答1: use: e.getAction() == MotionEvent.ACTION_UP and: e.getAction() == MotionEvent.ACTION_MOVE if there was and ACTION_UP event after

setText() not working

≡放荡痞女 提交于 2020-01-07 02:07:31
问题 setText(), setTextsize() and addView is not working. It is shown as cannot resolve symbol type. Intent intent = getIntent(); String message = intent.getStringExtra(MyActivity.EXTRA_MESSAGE); TextView textView = new TextView(this); textView.setTextSize(40); textView.setText(message); RelativeLayout layout = (RelativeLayout) findViewById(R.id.content); layout.addView(textView); 回答1: You can't use methods such as add and find view by id before the layout is inflated. Verifý that setContentView